@deepseekcode/cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +134 -0
  2. package/dist/cli.js +1398 -0
  3. package/dist/stdin-worker.js +22 -0
  4. package/package.json +65 -0
  5. package/web/dist/assets/AgentFlowView-Cq5rwwHO.js +1 -0
  6. package/web/dist/assets/AgentsView-DvSlePx6.js +1 -0
  7. package/web/dist/assets/AskQuestionModal-bOMD8fv0.js +1 -0
  8. package/web/dist/assets/ChannelConfigView-ByhL7_5W.js +8 -0
  9. package/web/dist/assets/FileTreeView-DtYvBKee.js +11 -0
  10. package/web/dist/assets/HookApprovalModal-BOSEvhFh.js +1 -0
  11. package/web/dist/assets/HookConfigView-DIytJ_Pb.js +3 -0
  12. package/web/dist/assets/ModelsView-DOUNg5rX.js +1 -0
  13. package/web/dist/assets/SessionGrid-DS1RanMd.js +17 -0
  14. package/web/dist/assets/SettingsPanel-N5qcaI8b.js +3 -0
  15. package/web/dist/assets/SkillsView-H0sCdR5e.js +1 -0
  16. package/web/dist/assets/TerminalView-BFjl4bGT.js +3 -0
  17. package/web/dist/assets/TerminalView-C1Mzzh8g.css +32 -0
  18. package/web/dist/assets/Toast-DowV4l0w.js +1 -0
  19. package/web/dist/assets/ToolsView-DSl95dvA.js +1 -0
  20. package/web/dist/assets/hookRisk-DECuVQpA.js +1 -0
  21. package/web/dist/assets/icons-B_rAQLge.js +464 -0
  22. package/web/dist/assets/index-BhVUD1px.css +1 -0
  23. package/web/dist/assets/index-BtIzCXfW.js +20 -0
  24. package/web/dist/assets/markdown-BAhUvdx-.js +30 -0
  25. package/web/dist/assets/panels-p9MZH4aX.js +1 -0
  26. package/web/dist/assets/react-vendor-meeTdQCf.js +24 -0
  27. package/web/dist/assets/state-Cke1lss7.js +17 -0
  28. package/web/dist/assets/terminal-Ck_l6svU.js +9 -0
  29. package/web/dist/favicon.svg +12 -0
  30. package/web/dist/index.html +25 -0
  31. package/web/dist/logo.svg +12 -0
@@ -0,0 +1,17 @@
1
+ import{j as s,M as jr,P as Or}from"./markdown-BAhUvdx-.js";import{R as F,r as R,n as Lr,ah as _n,ak as rt,a as Tt,i as Vt,al as Pn,X as Fr,am as Hr,l as Dr,m as $n,K as zr,an as Mr,p as Br,ao as _r,aa as Pr,ap as $r,a8 as Ur,aq as Gr,L as Wr}from"./icons-B_rAQLge.js";import{x as Vr}from"./react-vendor-meeTdQCf.js";import{e as De,w as gt,i as fn,u as vt,j as ye,W as Kr,k as Yr,l as Rt,m as Xr,b as Zr,n as mn,d as Jr,S as Qr}from"./index-BtIzCXfW.js";import{c as qr,e as eo,R as to}from"./hookRisk-DECuVQpA.js";import"./state-Cke1lss7.js";const kt=0,ze=1,Ze=2,Un=4;function hn(e){return()=>e}function no(e){e()}function Gn(e,t){return n=>e(t(n))}function gn(e,t){return()=>e(t)}function ro(e,t){return n=>e(t,n)}function Kt(e){return e!==void 0}function oo(...e){return()=>{e.map(no)}}function Je(){}function yt(e,t){return t(e),e}function so(e,t){return t(e)}function ne(...e){return e}function Z(e,t){return e(ze,t)}function $(e,t){e(kt,t)}function Yt(e){e(Ze)}function oe(e){return e(Un)}function H(e,t){return Z(e,ro(t,kt))}function Ne(e,t){const n=e(ze,r=>{n(),t(r)});return n}function xn(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Wn(e,t){return e===t}function te(e=Wn){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function B(e){return t=>n=>{e(n)&&t(n)}}function O(e){return t=>Gn(t,e)}function Ae(e){return t=>()=>{t(e)}}function T(e,...t){const n=io(...t);return(r,o)=>{switch(r){case Ze:Yt(e);return;case ze:return Z(e,n(o))}}}function je(e,t){return n=>r=>{n(t=e(t,r))}}function Ue(e){return t=>n=>{e>0?e--:t(n)}}function Le(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function U(...e){const t=Array.from({length:e.length});let n=0,r=null;const o=2**e.length-1;return e.forEach((i,l)=>{const c=2**l;Z(i,a=>{const u=n;n|=c,t[l]=a,u!==o&&n===o&&r&&(r(),r=null)})}),i=>l=>{const c=()=>{i([l].concat(t))};n===o?c():r=c}}function io(...e){return t=>e.reduceRight(so,t)}function ao(e){let t,n;const r=()=>t==null?void 0:t();return function(o,i){switch(o){case ze:return i?n===i?void 0:(r(),n=i,t=Z(e,i),t):(r(),Je);case Ze:r(),n=null;return}}}function y(e){let t=e;const n=W();return(r,o)=>{switch(r){case kt:t=o;break;case ze:{o(t);break}case Un:return t}return n(r,o)}}function xe(e,t){return yt(y(t),n=>H(e,n))}function W(){const e=[];return(t,n)=>{switch(t){case kt:e.slice().forEach(r=>{r(n)});return;case Ze:e.splice(0);return;case ze:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}}}function Te(e){return yt(W(),t=>H(e,t))}const lo={singleton:!0};function Y(e,t=[],n=lo){const{singleton:r}=n;return{constructor:e,dependencies:t,id:co(),singleton:r}}const co=()=>Symbol("id");function uo(e){const t=new Map,n=({constructor:r,dependencies:o,id:i,singleton:l})=>{if(l&&t.has(i))return t.get(i);const c=r(o.map(a=>n(a)));return l&&t.set(i,c),c};return n(e)}function le(...e){const t=W(),n=Array.from({length:e.length});let r=0;const o=2**e.length-1;return e.forEach((i,l)=>{const c=2**l;Z(i,a=>{n[l]=a,r|=c,r===o&&$(t,n)})}),function(i,l){switch(i){case Ze:{Yt(t);return}case ze:return r===o&&l(n),Z(t,l)}}}function M(e,t=Wn){return T(e,te(t))}function Mt(...e){return function(t,n){switch(t){case Ze:return;case ze:return oo(...e.map(r=>Z(r,n)))}}}const fe={DEBUG:0,INFO:1,WARN:2,ERROR:3},po={[fe.DEBUG]:"debug",[fe.ERROR]:"error",[fe.INFO]:"log",[fe.WARN]:"warn"},fo=()=>typeof globalThis>"u"?window:globalThis,Me=Y(()=>{const e=y(fe.ERROR);return{log:y((t,n,r=fe.INFO)=>{const o=fo().VIRTUOSO_LOG_LEVEL??oe(e);r>=o&&console[po[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0}),Bt=new WeakMap;function Vn(e){return"self"in e?e.document.documentElement:e}function mo(e){const t=Vn(e),n=Bt.get(t);if(n!==void 0)return n;const r=t.ownerDocument.defaultView.getComputedStyle(t).direction==="rtl";return Bt.set(t,r),r}function bn(e){Bt.delete(Vn(e))}function Kn(e,t){return mo(e)?-t:t}const Pe=Kn;function vn(e,t){return Kn(e,t)}function Ge(e,t,n){return Xt(e,t,n).callbackRef}function Xt(e,t,n){const r=F.useRef(null);let o=l=>{};const i=F.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(l=>{const c=()=>{const a=l[0].target;a.offsetParent!==null&&e(a)};n?c():requestAnimationFrame(c)}):null,[e,n]);return o=l=>{l&&t?(i==null||i.observe(l),r.current=l):(r.current&&(i==null||i.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function ho(e,t,n,r,o,i,l,c,a){const u=F.useCallback(d=>{var h;const m=go(d.children,t,c?"offsetWidth":"offsetHeight",o);let g=d.parentElement;for(;g.dataset.virtuosoScroller===void 0;)g=g.parentElement;const x=((h=g.lastElementChild)==null?void 0:h.dataset.viewportType)==="window";let E;x&&(E=g.ownerDocument.defaultView);const k=l?c?l.scrollWidth:l.scrollHeight:x?c?E.document.documentElement.scrollWidth:E.document.documentElement.scrollHeight:c?g.scrollWidth:g.scrollHeight,b=l?c?l.offsetWidth:l.offsetHeight:x?c?E.innerWidth:E.innerHeight:c?g.offsetWidth:g.offsetHeight,f=l?c?Pe(l,l.scrollLeft):l.scrollTop:x?c?Pe(E,E.scrollX||E.document.documentElement.scrollLeft):E.scrollY||E.document.documentElement.scrollTop:c?Pe(g,g.scrollLeft):g.scrollTop;r({scrollHeight:k,scrollTop:Math.max(f,0),viewportHeight:b}),i==null||i(c?Sn("column-gap",getComputedStyle(d).columnGap,o):Sn("row-gap",getComputedStyle(d).rowGap,o)),m!==null&&e(m)},[e,t,o,i,l,r,c]);return Xt(u,n,a)}function go(e,t,n,r){const o=e.length;if(o===0)return null;const i=[];for(let l=0;l<o;l++){const c=e.item(l);if(c.dataset.index===void 0)continue;const a=parseInt(c.dataset.index,10),u=parseFloat(c.dataset.knownSize),d=t(c,n);if(d===0&&r("Zero-sized element, this should not happen",{child:c},fe.ERROR),d===u)continue;const m=i[i.length-1];i.length===0||m.size!==d||m.endIndex!==a-1?i.push({endIndex:a,size:d,startIndex:a}):i[i.length-1].endIndex++}return i}function Sn(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,fe.WARN),t==="normal"?0:parseInt(t??"0",10)}function Yn(e,t,n){const r=F.useRef(null),o=F.useCallback(a=>{if(!(a!=null&&a.offsetParent))return;const u=a.getBoundingClientRect(),d=u.width;let m,g;if(t){const x=t.getBoundingClientRect(),E=u.top-x.top;g=x.height-Math.max(0,E),m=E+t.scrollTop}else{const x=l.current.ownerDocument.defaultView;g=x.innerHeight-Math.max(0,u.top),m=u.top+x.scrollY}r.current={listHeight:u.height,offsetTop:m,visibleHeight:g,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:i,ref:l}=Xt(o,!0,n),c=F.useCallback(()=>{o(l.current)},[o,l]);return F.useEffect(()=>{var u;if(t){t.addEventListener("scroll",c);const d=new ResizeObserver(()=>{requestAnimationFrame(c)});return d.observe(t),()=>{t.removeEventListener("scroll",c),d.unobserve(t)}}const a=(u=l.current)==null?void 0:u.ownerDocument.defaultView;return a==null||a.addEventListener("scroll",c),a==null||a.addEventListener("resize",c),()=>{a==null||a.removeEventListener("scroll",c),a==null||a.removeEventListener("resize",c)}},[c,t,l]),i}const ve=Y(()=>{const e=W(),t=W(),n=y(0),r=W(),o=y(0),i=W(),l=W(),c=y(0),a=y(0),u=y(0),d=y(0),m=W(),g=W(),x=y(!1),E=y(!1),k=y(!1);return H(T(e,O(({scrollTop:b})=>b)),t),H(T(e,O(({scrollHeight:b})=>b)),l),H(t,o),{deviation:n,fixedFooterHeight:u,fixedHeaderHeight:a,footerHeight:d,headerHeight:c,horizontalDirection:E,scrollBy:g,scrollContainerState:e,scrollHeight:l,scrollingInProgress:x,scrollTo:m,scrollTop:t,skipAnimationFrameInResizeObserver:k,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:i}},[],{singleton:!0}),ot={lvl:0};function Xn(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const i=[];for(let l=1;l<n;l++){const{index:c,value:a}=t(e[l]);i.push({end:c-1,start:r,value:o}),r=c,o=a}return i.push({end:1/0,start:r,value:o}),i}function J(e){return e===ot}function st(e,t){if(!J(e))return t===e.k?e.v:t<e.k?st(e.l,t):st(e.r,t)}function Ce(e,t,n="k"){if(J(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Ce(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Ce(e.l,t,n)}function Ie(e,t,n){return J(e)?Qn(t,n,1):t===e.k?pe(e,{k:t,v:n}):t<e.k?In(pe(e,{l:Ie(e.l,t,n)})):In(pe(e,{r:Ie(e.r,t,n)}))}function Ye(){return ot}function Xe(e,t,n){if(J(e))return[];const r=Ce(e,t)[0];return xo(Pt(e,r,n))}function _t(e,t){if(J(e))return ot;const{k:n,l:r,r:o}=e;if(t===n){if(J(r))return o;if(J(o))return r;const[i,l]=Jn(r);return St(pe(e,{k:i,l:Zn(r),v:l}))}return t<n?St(pe(e,{l:_t(r,t)})):St(pe(e,{r:_t(o,t)}))}function $e(e){return J(e)?[]:[...$e(e.l),{k:e.k,v:e.v},...$e(e.r)]}function Pt(e,t,n){if(J(e))return[];const{k:r,l:o,r:i,v:l}=e;let c=[];return r>t&&(c=c.concat(Pt(o,t,n))),r>=t&&r<=n&&c.push({k:r,v:l}),r<=n&&(c=c.concat(Pt(i,t,n))),c}function St(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(At(t))return qn(pe(e,{lvl:n-1}));if(!J(t)&&!J(t.r))return pe(t.r,{l:pe(t,{r:t.r.l}),lvl:n,r:pe(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(At(e))return $t(pe(e,{lvl:n-1}));if(!J(r)&&!J(r.l)){const o=r.l,i=At(o)?r.lvl-1:r.lvl;return pe(o,{l:pe(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:$t(pe(r,{l:o.r,lvl:i}))})}throw new Error("Unexpected empty nodes")}function pe(e,t){return Qn(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function Zn(e){return J(e.r)?e.l:St(pe(e,{r:Zn(e.r)}))}function At(e){return J(e)||e.lvl>e.r.lvl}function Jn(e){return J(e.r)?[e.k,e.v]:Jn(e.r)}function Qn(e,t,n,r=ot,o=ot){return{k:e,l:r,lvl:n,r:o,v:t}}function In(e){return $t(qn(e))}function qn(e){const{l:t}=e;return!J(t)&&t.lvl===e.lvl?pe(t,{r:pe(e,{l:t.r})}):e}function $t(e){const{lvl:t,r:n}=e;return!J(n)&&!J(n.r)&&n.lvl===t&&n.r.lvl===t?pe(n,{l:pe(e,{r:n.l}),lvl:t+1}):e}function xo(e){return Xn(e,({k:t,v:n})=>({index:t,value:n}))}function er(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function it(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Zt=Y(()=>({recalcInProgress:y(!1)}),[],{singleton:!0});function tr(e,t,n){return e[Et(e,t,n)]}function Et(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const i=Math.floor((r+o)/2),l=e[i],c=n(l,t);if(c===0)return i;if(c===-1){if(o-r<2)return i-1;o=i-1}else{if(o===r)return i;r=i+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function bo(e,t,n,r){const o=Et(e,t,r),i=Et(e,n,r,o);return e.slice(o,i+1)}function He(e,t){return Math.round(e.getBoundingClientRect()[t])}function Nt(e){return!J(e.groupOffsetTree)}function Jt({index:e},t){return t===e?0:t<e?-1:1}function vo(){return{groupIndices:[],groupOffsetTree:Ye(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ye()}}function So(e,t){let n=J(e)?0:1/0;for(const r of t){const{endIndex:o,size:i,startIndex:l}=r;if(n=Math.min(n,l),J(e)){e=Ie(e,0,i);continue}const c=Xe(e,l-1,o+1);if(c.some(No(r)))continue;let a=!1,u=!1;for(const{end:d,start:m,value:g}of c)a?(o>=m||i===g)&&(e=_t(e,m)):(u=g!==i,a=!0),d>o&&o>=m&&g!==i&&(e=Ie(e,o+1,g));u&&(e=Ie(e,l,i))}return[e,n]}function Io(e){return e.groupIndex!==void 0}function To({offset:e},t){return t===e?0:t<e?-1:1}function at(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:i}=tr(t,e,Jt),l=e-r,c=i*l+(l-1)*n+o;return c>0?c+n:c}function nr(e,t){if(!Nt(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function rr(e,t,n){if(Io(e))return t.groupIndices[e.groupIndex]+1;const r=e.index==="LAST"?n:e.index;let o=nr(r,t);return o=Math.max(0,Math.min(n,o)),o}function Eo(e,t,n,r=0){return r>0&&(t=Math.max(t,tr(e,r,Jt).offset)),Xn(bo(e,t,n,To),yo)}function wo(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,fe.DEBUG);const i=e.sizeTree;let l=i,c=0;if(n.length>0&&J(i)&&t.length===2){const g=t[0].size,x=t[1].size;l=n.reduce((E,k)=>Ie(Ie(E,k,g),k+1,x),l)}else[l,c]=So(l,t);if(l===i)return e;const{lastIndex:a,lastOffset:u,lastSize:d,offsetTree:m}=Ut(e.offsetTree,c,l,o);return{groupIndices:n,groupOffsetTree:n.reduce((g,x)=>Ie(g,x,at(x,m,o)),Ye()),lastIndex:a,lastOffset:u,lastSize:d,offsetTree:m,sizeTree:l}}function ko(e){return $e(e).map(({k:t,v:n},r,o)=>{const i=o[r+1];return{endIndex:i===void 0?1/0:i.k-1,size:n,startIndex:t}})}function Tn(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function Ut(e,t,n,r){let o=e,i=0,l=0,c=0,a=0;if(t===0)o=[];else{a=Et(o,t-1,Jt),c=o[a].offset;const u=Ce(n,t-1);i=u[0],l=u[1],o.length&&o[a].size===Ce(n,t)[1]&&(a-=1),o=o.slice(0,a+1)}for(const{start:u,value:d}of Xe(n,t,1/0)){const m=u-i,g=m*l+c+m*r;o.push({index:u,offset:g,size:d}),i=u,c=g,l=d}return{lastIndex:i,lastOffset:c,lastSize:l,offsetTree:o}}function yo(e){return{index:e.index,value:e}}function No(e){const{endIndex:t,size:n,startIndex:r}=e;return o=>o.start===r&&(o.end===t||o.end===1/0)&&o.value===n}const Co={offsetHeight:"height",offsetWidth:"width"},Oe=Y(([{log:e},{recalcInProgress:t}])=>{const n=W(),r=W(),o=xe(r,0),i=W(),l=W(),c=y(0),a=y([]),u=y(void 0),d=y(void 0),m=y(void 0),g=y(void 0),x=y((p,v)=>He(p,Co[v])),E=y(void 0),k=y(0),b=vo(),f=xe(T(n,U(a,e,k),je(wo,b),te()),b),h=xe(T(a,te(),je((p,v)=>({current:v,prev:p.current}),{current:[],prev:[]}),O(({prev:p})=>p)),[]);H(T(a,B(p=>p.length>0),U(f,k),O(([p,v,C])=>{const w=p.reduce((A,_,L)=>Ie(A,_,at(_,v.offsetTree,C)||L),Ye());return{...v,groupIndices:p,groupOffsetTree:w}})),f),H(T(r,U(f),B(([p,{lastIndex:v}])=>p<v),O(([p,{lastIndex:v,lastSize:C}])=>[{endIndex:v,size:C,startIndex:p}])),n),H(u,d);const S=xe(T(u,O(p=>p===void 0)),!0);H(T(d,B(p=>p!==void 0&&J(oe(f).sizeTree)),O(p=>{const v=oe(m),C=oe(a).length>0;return v!==void 0&&v!==0?C?[{endIndex:0,size:v,startIndex:0},{endIndex:1,size:p,startIndex:1}]:[]:[{endIndex:0,size:p,startIndex:0}]})),n),H(T(g,B(p=>p!==void 0&&p.length>0&&J(oe(f).sizeTree)),O(p=>{const v=[];let C=p[0],w=0;for(let A=1;A<p.length;A++){const _=p[A];_!==C&&(v.push({endIndex:A-1,size:C,startIndex:w}),C=_,w=A)}return v.push({endIndex:p.length-1,size:C,startIndex:w}),v})),n),H(T(a,U(m,d),B(([,p,v])=>p!==void 0&&v!==void 0),O(([p,v,C])=>{const w=[];for(let A=0;A<p.length;A++){const _=p[A],L=p[A+1];w.push({startIndex:_,endIndex:_,size:v}),L!==void 0&&w.push({startIndex:_+1,endIndex:L-1,size:C})}return w})),n);const N=Te(T(n,U(f),je(({sizes:p},[v,C])=>({changed:C!==p,sizes:C}),{changed:!1,sizes:b}),O(p=>p.changed)));Z(T(c,je((p,v)=>({diff:p.prev-v,prev:v}),{diff:0,prev:0}),O(p=>p.diff)),p=>{const{groupIndices:v}=oe(f);if(p>0)$(t,!0),$(i,p+Tn(p,v));else if(p<0){const C=oe(h);C.length>0&&(p-=Tn(-p,C)),$(l,p)}}),Z(T(c,U(e)),([p,v])=>{p<0&&v("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},fe.ERROR)});const I=Te(i);H(T(i,U(f),O(([p,v])=>{const C=v.groupIndices.length>0,w=[],A=v.lastSize;if(C){const _=st(v.sizeTree,0);let L=0,z=0;for(;L<p;){const K=v.groupIndices[z],V=v.groupIndices.length===z+1?1/0:v.groupIndices[z+1]-K-1;w.push({endIndex:K,size:_,startIndex:K}),w.push({endIndex:K+1+V-1,size:A,startIndex:K+1}),z++,L+=V+1}const G=$e(v.sizeTree);return L!==p&&G.shift(),G.reduce((K,{k:V,v:ce})=>{let Ee=K.ranges;return K.prevSize!==0&&(Ee=[...K.ranges,{endIndex:V+p-1,size:K.prevSize,startIndex:K.prevIndex}]),{prevIndex:V+p,prevSize:ce,ranges:Ee}},{prevIndex:p,prevSize:0,ranges:w}).ranges}return $e(v.sizeTree).reduce((_,{k:L,v:z})=>({prevIndex:L+p,prevSize:z,ranges:[..._.ranges,{endIndex:L+p-1,size:_.prevSize,startIndex:_.prevIndex}]}),{prevIndex:0,prevSize:A,ranges:[]}).ranges})),n);const D=Te(T(l,U(f,k),O(([p,{offsetTree:v},C])=>{const w=-p;return at(w,v,C)})));return H(T(l,U(f,k),O(([p,v,C])=>{if(v.groupIndices.length>0){if(J(v.sizeTree))return v;let A=Ye();const _=oe(h);let L=0,z=0,G=0;for(;L<-p;){G=_[z];const K=_[z+1]-G-1;z++,L+=K+1}if(A=$e(v.sizeTree).reduce((K,{k:V,v:ce})=>Ie(K,Math.max(0,V+p),ce),A),L!==-p){const K=st(v.sizeTree,G);A=Ie(A,0,K);const V=Ce(v.sizeTree,-p+1)[1];A=Ie(A,1,V)}return{...v,sizeTree:A,...Ut(v.offsetTree,0,A,C)}}const w=$e(v.sizeTree).reduce((A,{k:_,v:L})=>Ie(A,Math.max(0,_+p),L),Ye());return{...v,sizeTree:w,...Ut(v.offsetTree,0,w,C)}})),f),{beforeUnshiftWith:I,data:E,defaultItemSize:d,firstItemIndex:c,fixedItemSize:u,fixedGroupSize:m,gap:k,groupIndices:a,heightEstimates:g,itemSize:x,listRefresh:N,shiftWith:l,shiftWithOffset:D,sizeRanges:n,sizes:f,statefulTotalCount:o,totalCount:r,trackItemSizes:S,unshiftWith:i}},ne(Me,Zt),{singleton:!0});function Ro(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const or=Y(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const i=W(),l=W(),c=Te(T(i,O(Ro)));return H(T(c,O(a=>a.totalCount)),n),H(T(c,O(a=>a.groupIndices)),e),H(T(le(o,t,r),B(([a,u])=>Nt(u)),O(([a,u,d])=>Ce(u.groupOffsetTree,Math.max(a-d,0),"v")[0]),te(),O(a=>[a])),l),{groupCounts:i,topItemsIndexes:l}},ne(Oe,ve)),Be=Y(([{log:e}])=>{const t=y(!1),n=Te(T(t,B(r=>r),te()));return Z(t,r=>{r&&oe(e)("props updated",{},fe.DEBUG)}),{didMount:n,propsReady:t}},ne(Me),{singleton:!0}),Ao=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function sr(e){const t=typeof e=="number"?{index:e}:{...e};return t.align||(t.align="start"),(!t.behavior||!Ao)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const dt=Y(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:i,footerHeight:l,headerHeight:c,scrollingInProgress:a,scrollTo:u,smoothScrollTargetReached:d,viewportHeight:m},{log:g}])=>{const x=W(),E=W(),k=y(0);let b=null,f=null,h=null;function S(){b!==null&&(b(),b=null),h!==null&&(h(),h=null),f&&(clearTimeout(f),f=null),$(a,!1)}return H(T(x,U(n,m,r,k,c,l,g),U(e,i,o),O(([[N,I,D,p,v,C,w,A],_,L,z])=>{const G=sr(N),{align:K,behavior:V,offset:ce}=G,Ee=p-1,me=rr(G,I,Ee);let Se=at(me,I.offsetTree,_)+C;K==="end"?(Se+=L+Ce(I.sizeTree,me)[1]-D+z,me===Ee&&(Se+=w)):K==="center"?Se+=(L+Ce(I.sizeTree,me)[1]-D+z)/2:Se-=v,ce!==void 0&&ce!==0&&(Se+=ce);const Fe=he=>{S(),he?(A("retrying to scroll to",{location:N},fe.DEBUG),$(x,N)):($(E,!0),A("list did not change, scroll successful",{},fe.DEBUG))};if(S(),V==="smooth"){let he=!1;h=Z(t,Ve=>{he=he||Ve}),b=Ne(d,()=>{Fe(he)})}else b=Ne(T(t,jo(150)),Fe);return f=setTimeout(()=>{S()},1200),$(a,!0),A("scrolling from index to",{behavior:V,index:me,top:Se},fe.DEBUG),{behavior:V,top:Se}})),u),{scrollTargetReached:E,scrollToIndex:x,topListHeight:k}},ne(Oe,ve,Me),{singleton:!0});function jo(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function Qt(e,t){e===0?t():requestAnimationFrame(()=>{Qt(e-1,t)})}function qt(e,t){if(e===void 0)return 0;const n=t-1,r=typeof e=="number"?e:e.index==="LAST"?n:e.index;return Math.max(0,Math.min(r,n))}function Gt(e){return e===void 0?!0:typeof e=="number"?e===0:e.index===0&&(e.align===void 0||e.align==="start")&&(e.offset===void 0||e.offset===0)}const pt=Y(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:i},{didMount:l}])=>{const c=y(!0),a=y(0),u=y(!0);return H(T(l,U(a),B(([d,m])=>!Gt(m)),Ae(!1)),c),H(T(l,U(a),B(([d,m])=>!Gt(m)),Ae(!1)),u),Z(T(le(t,l),U(c,n,e,u),B(([[,d],m,{sizeTree:g},x,E])=>d&&(!J(g)||Kt(x))&&!m&&!E),U(a)),([,d])=>{if(d===void 0){$(c,!0),$(u,!0);return}Ne(o,()=>{$(u,!0)}),Qt(4,()=>{Ne(r,()=>{$(c,!0)}),$(i,d)})}),{initialItemFinalLocationReached:u,initialTopMostItemIndex:a,scrolledToInitialItem:c}},ne(Oe,ve,dt,Be),{singleton:!0});function ir(e,t){return Math.abs(e-t)<1.01}const lt="up",tt="down",Oo="none",Lo={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Fo=0,ft=Y(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:i}])=>{const l=y(!1),c=y(!0),a=W(),u=W(),d=y(4),m=y(Fo),g=xe(T(Mt(T(M(o),Ue(1),Ae(!0)),T(M(o),Ue(1),Ae(!1),xn(100))),te()),!1),x=xe(T(Mt(T(n,Ae(!0)),T(n,Ae(!1),xn(200))),te()),!1);H(T(le(M(o),M(m)),O(([h,S])=>h<=S),te()),c),H(T(c,Le(50)),u);const E=Te(T(le(r,M(i),M(t),M(e),M(d)),je((h,[{scrollHeight:S,scrollTop:N},I,D,p,v])=>{const C=N+I-S>-v,w={scrollHeight:S,scrollTop:N,viewportHeight:I};if(C){let _,L;return N>h.state.scrollTop?(_="SCROLLED_DOWN",L=h.state.scrollTop-N):(_="SIZE_DECREASED",L=h.state.scrollTop-N||h.scrollTopDelta),{atBottom:!0,atBottomBecause:_,scrollTopDelta:L,state:w}}let A;return w.scrollHeight>h.state.scrollHeight?A="SIZE_INCREASED":I<h.state.viewportHeight?A="VIEWPORT_HEIGHT_DECREASING":N<h.state.scrollTop?A="SCROLLING_UPWARDS":A="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:A,state:w}},Lo),te((h,S)=>h!==void 0&&h.atBottom===S.atBottom))),k=xe(T(r,je((h,{scrollHeight:S,scrollTop:N,viewportHeight:I})=>{if(!ir(h.scrollHeight,S)){const D=S-(N+I)<1;return h.scrollTop!==N&&D?{changed:!0,jump:h.scrollTop-N,scrollHeight:S,scrollTop:N}:{changed:!0,jump:0,scrollHeight:S,scrollTop:N}}return{changed:!1,jump:0,scrollHeight:S,scrollTop:N}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),B(h=>h.changed),O(h=>h.jump)),0);H(T(E,O(h=>h.atBottom)),l),H(T(l,Le(50)),a);const b=y(tt);H(T(r,O(({scrollTop:h})=>h),te(),je((h,S)=>oe(x)?{direction:h.direction,prevScrollTop:S}:{direction:S<h.prevScrollTop?lt:tt,prevScrollTop:S},{direction:tt,prevScrollTop:0}),O(h=>h.direction)),b),H(T(r,Le(50),Ae(Oo)),b);const f=y(0);return H(T(g,B(h=>!h),Ae(0)),f),H(T(o,Le(100),U(g),B(([h,S])=>S),je(([h,S],[N])=>[S,N],[0,0]),O(([h,S])=>S-h)),f),{atBottomState:E,atBottomStateChange:a,atBottomThreshold:d,atTopStateChange:u,atTopThreshold:m,isAtBottom:l,isAtTop:c,isScrolling:g,lastJumpDueToItemResize:k,scrollDirection:b,scrollVelocity:f}},ne(ve)),ct="top",ut="bottom",En="none";function wn(e,t,n){return typeof e=="number"?n===lt&&t===ct||n===tt&&t===ut?e:0:n===lt?t===ct?e.main:e.reverse:t===ut?e.main:e.reverse}function kn(e,t){return typeof e=="number"?e:e[t]??0}const en=Y(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const i=W(),l=y(0),c=y(0),a=y(0),u=xe(T(le(M(r),M(o),M(n),M(i,it),M(a),M(l),M(t),M(e),M(c)),O(([d,m,g,[x,E],k,b,f,h,S])=>{const N=d-h,I=b+f,D=Math.max(g-N,0);let p=En;const v=kn(S,ct),C=kn(S,ut);return x-=h,x+=g+f,E+=g+f,E-=h,x>d+I-v&&(p=lt),E<d-D+m+C&&(p=tt),p!==En?[Math.max(N-g-wn(k,ct,p)-v,0),N-D-f+m+wn(k,ut,p)+C]:null}),B(d=>d!==null),te(it)),[0,0]);return{increaseViewportBy:c,listBoundary:i,overscan:a,topListHeight:l,visibleRange:u}},ne(ve),{singleton:!0});function Ho(e,t,n){if(Nt(t)){const r=nr(e,t);return[{index:Ce(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const jt={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function It(e,t,n,r,o,i){const{lastIndex:l,lastOffset:c,lastSize:a}=o;let u=0,d=0;if(e.length>0){u=e[0].offset;const k=e[e.length-1];d=k.offset+k.size}const m=n-l,g=c+m*a+(m-1)*r,x=u,E=g-d;return{bottom:d,firstItemIndex:i,items:yn(e,o,i),offsetBottom:E,offsetTop:u,top:x,topItems:yn(t,o,i),topListHeight:t.reduce((k,b)=>b.size+k,0),totalCount:n}}function ar(e,t,n,r,o,i){let l=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-l>=e)break;l++}const c=e+l,a=qt(t,c),u=Array.from({length:c}).map((d,m)=>({data:i[m+a],index:m+a,offset:0,size:0}));return It(u,[],c,o,n,r)}function yn(e,t,n){if(e.length===0)return[];if(!Nt(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const r=e[0].index,o=e[e.length-1].index,i=[],l=Xe(t.groupOffsetTree,r,o);let c,a=0;for(const u of e){(!c||c.end<u.index)&&(c=l.shift(),a=t.groupIndices.indexOf(c.start));let d;u.index===c.start?d={index:a,type:"group"}:d={groupIndex:a,index:u.index-(a+1)+n},i.push({...d,data:u.data,offset:u.offset,originalIndex:u.index,size:u.size})}return i}function Nn(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const We=Y(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},i,{listBoundary:l,topListHeight:c,visibleRange:a},{initialTopMostItemIndex:u,scrolledToInitialItem:d},{topListHeight:m},g,{didMount:x},{recalcInProgress:E}])=>{const k=y([]),b=y(0),f=W(),h=y(0);H(i.topItemsIndexes,k);const S=xe(T(le(x,E,M(a,it),M(o),M(r),M(u),d,M(k),M(t),M(n),M(h),e),B(([p,v,,C,,,,,,,,w])=>{const A=w!==void 0&&w.length!==C;return p&&!v&&!A}),O(([,,[p,v],C,w,A,_,L,z,G,K,V])=>{var X,ue;const ce=w,{offsetTree:Ee,sizeTree:me}=ce,Se=oe(b);if(C===0)return{...jt,totalCount:C};if(p===0&&v===0)return Se===0?{...jt,totalCount:C}:ar(Se,A,w,z,G,V||[]);if(J(me))return Se>0?null:It(Ho(qt(A,C),ce,V),[],C,G,ce,z);const Fe=[];if(L.length>0){const q=L[0],re=L[L.length-1];let de=0;for(const ie of Xe(me,q,re)){const Q=ie.value,se=Math.max(ie.start,q),be=Math.min(ie.end,re);for(let ae=se;ae<=be;ae++)Fe.push({data:V==null?void 0:V[ae],index:ae,offset:de,size:Q}),de+=Q}}if(!_)return It([],Fe,C,G,ce,z);const he=L.length>0?L[L.length-1]+1:0,Ve=Eo(Ee,p,v,he);if(Ve.length===0)return null;const Qe=C-1,Re=yt([],q=>{for(const re of Ve){const de=re.value;let ie=de.offset,Q=re.start;const se=de.size;if(de.offset<p){Q+=Math.floor((p-de.offset+G)/(se+G));const ae=Q-re.start;ie+=ae*se+ae*G}Q<he&&(ie+=(he-Q)*se,Q=he);const be=Math.min(re.end,Qe);for(let ae=Q;ae<=be&&!(ie>=v);ae++)q.push({data:V==null?void 0:V[ae],index:ae,offset:ie,size:se}),ie+=se+G}}),qe=Nn(K,ct),j=Nn(K,ut);if(Re.length>0&&(qe>0||j>0)){const q=Re[0],re=Re[Re.length-1];if(qe>0&&q.index>he){const de=Math.min(qe,q.index-he),ie=[];let Q=q.offset;for(let se=q.index-1;se>=q.index-de;se--){const be=((X=Xe(me,se,se)[0])==null?void 0:X.value)??q.size;Q-=be+G,ie.unshift({data:V==null?void 0:V[se],index:se,offset:Q,size:be})}Re.unshift(...ie)}if(j>0&&re.index<Qe){const de=Math.min(j,Qe-re.index);let ie=re.offset+re.size+G;for(let Q=re.index+1;Q<=re.index+de;Q++){const se=((ue=Xe(me,Q,Q)[0])==null?void 0:ue.value)??re.size;Re.push({data:V==null?void 0:V[Q],index:Q,offset:ie,size:se}),ie+=se+G}}}return It(Re,Fe,C,G,ce,z)}),B(p=>p!==null),te()),jt);H(T(e,B(Kt),O(p=>p==null?void 0:p.length)),o),H(T(S,O(p=>p.topListHeight)),m),H(m,c),H(T(S,O(p=>[p.top,p.bottom])),l),H(T(S,O(p=>p.items)),f);const N=Te(T(S,B(({items:p})=>p.length>0),U(o,e),B(([{items:p},v])=>p[p.length-1].originalIndex===v-1),O(([,p,v])=>[p-1,v]),te(it),O(([p])=>p))),I=Te(T(S,Le(200),B(({items:p,topItems:v})=>p.length>0&&p[0].originalIndex===v.length),O(({items:p})=>p[0].index),te())),D=Te(T(S,B(({items:p})=>p.length>0),O(({items:p})=>{let v=0,C=p.length-1;for(;p[v].type==="group"&&v<C;)v++;for(;p[C].type==="group"&&C>v;)C--;return{endIndex:p[C].index,startIndex:p[v].index}}),te(er)));return{endReached:N,initialItemCount:b,itemsRendered:f,listState:S,minOverscanItemCount:h,rangeChanged:D,startReached:I,topItemsIndexes:k,...g}},ne(Oe,or,en,pt,dt,ft,Be,Zt),{singleton:!0}),lr=Y(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const i=W(),l=xe(T(le(n,e,r,t,o),O(([c,a,u,d,m])=>c+a+u+d+m.offsetBottom+m.bottom)),0);return H(M(l),i),{totalListHeight:l,totalListHeightChanged:i}},ne(ve,We),{singleton:!0}),Do=Y(([{viewportHeight:e},{totalListHeight:t}])=>{const n=y(!1),r=xe(T(le(n,e,t),B(([o])=>o),O(([,o,i])=>Math.max(0,o-i)),Le(0),te()),0);return{alignToBottom:n,paddingTopAddition:r}},ne(ve,lr),{singleton:!0}),cr=Y(()=>({context:y(null)})),zo=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...o},viewportBottom:i,viewportTop:l})=>t<l?{...o,align:n??"start",...r===void 0?{}:{behavior:r}}:e>i?{...o,align:n??"end",...r===void 0?{}:{behavior:r}}:null,ur=Y(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:i,scrollingInProgress:l,scrollTop:c,viewportHeight:a},{scrollToIndex:u}])=>{const d=W();return H(T(d,U(t,a,n,i,o,r,c),U(e),O(([[m,g,x,E,k,b,f,h],S])=>{const{calculateViewLocation:N=zo,done:I,...D}=m,p=rr(m,g,E-1),v=at(p,g.offsetTree,S)+k+b,C=v+Ce(g.sizeTree,p)[1],w=h+b,A=h+x-f,_=N({itemBottom:C,itemTop:v,locationParams:D,viewportBottom:A,viewportTop:w});return _===null?I==null||I():I&&Ne(T(l,B(L=>!L),Ue(oe(l)?1:2)),I),_}),B(m=>m!==null)),u),{scrollIntoView:d}},ne(Oe,ve,dt,We,Me),{singleton:!0});function Cn(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const Mo=(e,t)=>typeof e=="function"?Cn(e(t)):t&&Cn(e),Bo=Y(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:i},{scrollToIndex:l},{scrolledToInitialItem:c},{didMount:a,propsReady:u},{log:d},{scrollingInProgress:m},{context:g},{scrollIntoView:x}])=>{const E=y(!1),k=W();let b=null;function f(I){$(l,{align:"end",behavior:I,index:"LAST"})}Z(T(le(T(M(t),Ue(1)),a),U(M(E),i,c,m),O(([[I,D],p,v,C,w])=>{let A=D&&C,_="auto";return A&&(_=Mo(p,v||w),A=A&&_!==!1),{followOutputBehavior:_,shouldFollow:A,totalCount:I}}),B(({shouldFollow:I})=>I)),({followOutputBehavior:I,totalCount:D})=>{b!==null&&(b(),b=null),oe(n)===void 0?b=Ne(e,()=>{oe(d)("following output to ",{totalCount:D},fe.DEBUG),f(I),b=null}):requestAnimationFrame(()=>{oe(d)("following output to ",{totalCount:D},fe.DEBUG),f(I)})});function h(I){const D=Ne(o,p=>{I&&!p.atBottom&&p.notAtBottomBecause==="SIZE_INCREASED"&&b===null&&(oe(d)("scrolling to bottom due to increased size",{},fe.DEBUG),f("auto"))});setTimeout(D,100)}Z(T(le(M(E),t,u),B(([I,,D])=>I!==!1&&D),je(({value:I},[,D])=>({refreshed:I===D,value:D}),{refreshed:!1,value:0}),B(({refreshed:I})=>I),U(E,t)),([,I])=>{oe(c)&&h(I!==!1)}),Z(k,()=>{h(oe(E)!==!1)}),Z(le(M(E),o),([I,D])=>{I!==!1&&!D.atBottom&&D.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&f("auto")});const S=y(null),N=W();return H(Mt(T(M(r),O(I=>(I==null?void 0:I.length)??0)),T(M(t))),N),Z(T(le(T(N,Ue(1)),a),U(M(S),c,m,g),O(([[I,D],p,v,C,w])=>D&&v&&(p==null?void 0:p({context:w,totalCount:I,scrollingInProgress:C}))),B(I=>!!I),Le(0)),I=>{b!==null&&(b(),b=null),oe(n)===void 0?b=Ne(e,()=>{oe(d)("scrolling into view",{}),$(x,I),b=null}):requestAnimationFrame(()=>{oe(d)("scrolling into view",{}),$(x,I)})}),{autoscrollToBottom:k,followOutput:E,scrollIntoViewOnChange:S}},ne(Oe,ft,dt,pt,Be,Me,ve,cr,ur)),_o=Y(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:i,listState:l},{didMount:c}])=>(H(T(c,U(i),B(([,a])=>a!==0),U(o,r,t,n,e),O(([[,a],u,d,m,g,x=[]])=>ar(a,u,d,m,g,x))),l),{}),ne(Oe,pt,We,Be),{singleton:!0}),Po=Y(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=y(0);return Z(T(e,U(r),B(([,o])=>o!==0),O(([,o])=>({top:o}))),o=>{Ne(T(n,Ue(1),B(i=>i.items.length>1)),()=>{requestAnimationFrame(()=>{$(t,o)})})}),{initialScrollTop:r}},ne(Be,ve,We),{singleton:!0}),dr=Y(([{scrollVelocity:e}])=>{const t=y(!1),n=W(),r=y(!1);return H(T(e,U(r,t,n),B(([o,i])=>i!==!1&&i!==void 0),O(([o,i,l,c])=>{const{enter:a,exit:u}=i;if(l){if(u(o,c))return!1}else if(a(o,c))return!0;return l}),te()),t),Z(T(le(t,e,n),U(r)),([[o,i,l],c])=>{o&&c!==!1&&c!==void 0&&c.change&&c.change(i,l)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},ne(ft),{singleton:!0}),tn=Y(([{scrollContainerState:e,scrollTo:t}])=>{const n=W(),r=W(),o=W(),i=y(!1),l=y(void 0);return H(T(le(n,r),O(([{scrollTop:c,viewportHeight:a},{offsetTop:u,listHeight:d}])=>({scrollHeight:d,scrollTop:Math.max(0,c-u),viewportHeight:a}))),e),H(T(t,U(r),O(([c,{offsetTop:a}])=>({...c,top:c.top+a}))),o),{customScrollParent:l,useWindowScroll:i,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},ne(ve)),$o=Y(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:i},{useWindowScroll:l,windowScrollContainerState:c,windowViewportRect:a}])=>{const u=W(),d=y(void 0),m=y(null),g=y(null);return H(c,m),H(a,g),Z(T(u,U(t,r,l,m,g,n)),([x,E,k,b,f,h,S])=>{const N=ko(E.sizeTree);b&&f!==null&&h!==null&&(k=f.scrollTop-h.offsetTop),k-=S,x({ranges:N,scrollTop:k})}),H(T(d,B(Kt),O(Uo)),o),H(T(i,U(d),B(([,x])=>x!==void 0),te(),O(([,x])=>x.ranges)),e),{getState:u,restoreStateFrom:d}},ne(Oe,ve,pt,Be,tn));function Uo(e){return{align:"start",index:0,offset:e.scrollTop}}const Go=Y(([{topItemsIndexes:e}])=>{const t=y(0);return H(T(t,B(n=>n>=0),O(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},ne(We));function pr(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const Wo=pr(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Vo=Y(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:i,lastJumpDueToItemResize:l,scrollDirection:c},{listState:a},{beforeUnshiftWith:u,gap:d,shiftWithOffset:m,sizes:g},{log:x},{recalcInProgress:E}])=>{const k=Te(T(a,U(l),je(([,f,h,S],[{bottom:N,items:I,offsetBottom:D,totalCount:p},v])=>{const C=N+D;let w=0;return h===p&&f.length>0&&I.length>0&&(I[0].originalIndex===0&&f[0].originalIndex===0||(w=C-S,w!==0&&(w+=v))),[w,I,p,C]},[0,[],0,0]),B(([f])=>f!==0),U(r,c,n,o,x,E),B(([,f,h,S,,,N])=>!N&&!S&&f!==0&&h===lt),O(([[f],,,,,h])=>(h("Upward scrolling compensation",{amount:f},fe.DEBUG),f))));function b(f){f>0?($(t,{behavior:"auto",top:-f}),$(e,0)):($(e,0),$(t,{behavior:"auto",top:-f}))}return Z(T(k,U(e,i)),([f,h,S])=>{S&&Wo()?$(e,h-f):b(-f)}),Z(T(le(xe(i,!1),e,E),B(([f,h,S])=>!f&&!S&&h!==0),O(([f,h])=>h),Le(1)),b),H(T(m,O(f=>({top:-f}))),t),Z(T(u,U(g,d),O(([f,{groupIndices:h,lastSize:S,sizeTree:N},I])=>{function D(A){return A*(S+I)}if(h.length===0)return D(f);let p=0;const v=st(N,0);let C=0,w=0;for(;C<f;){C++,p+=v;let A=h.length===w+1?1/0:h[w+1]-h[w]-1;C+A>f&&(p-=v,A=f-C+1),C+=A,p+=D(A),w++}return p})),f=>{$(e,f),requestAnimationFrame(()=>{$(t,{top:f}),requestAnimationFrame(()=>{$(e,0),$(E,!1)})})}),{deviation:e}},ne(ve,ft,We,Oe,Me,Zt)),Ko=Y(([e,t,n,r,o,i,l,c,a,u,d])=>({...e,...t,...n,...r,...o,...i,...l,...c,...a,...u,...d}),ne(en,_o,Be,dr,lr,Po,Do,tn,ur,Me,cr)),fr=Y(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:i,groupIndices:l,heightEstimates:c,itemSize:a,sizeRanges:u,sizes:d,statefulTotalCount:m,totalCount:g,trackItemSizes:x},{initialItemFinalLocationReached:E,initialTopMostItemIndex:k,scrolledToInitialItem:b},f,h,S,N,{scrollToIndex:I},D,{topItemCount:p},{groupCounts:v},C])=>{const{listState:w,minOverscanItemCount:A,topItemsIndexes:_,rangeChanged:L,...z}=N;return H(L,C.scrollSeekRangeChanged),H(T(C.windowViewportRect,O(G=>G.visibleHeight)),f.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:o,gap:i,groupCounts:v,heightEstimates:c,initialItemFinalLocationReached:E,initialTopMostItemIndex:k,scrolledToInitialItem:b,sizeRanges:u,topItemCount:p,topItemsIndexes:_,totalCount:g,...S,groupIndices:l,itemSize:a,listState:w,minOverscanItemCount:A,scrollToIndex:I,statefulTotalCount:m,trackItemSizes:x,rangeChanged:L,...z,...C,...f,sizes:d,...h}},ne(Oe,pt,ve,$o,Bo,We,dt,Vo,Go,or,Ko));function Yo(e,t){const n={},r={};let o=0;const i=e.length;for(;o<i;)r[e[o]]=1,o+=1;for(const l in t)Object.hasOwn(r,l)||(n[l]=t[l]);return n}const xt=typeof document>"u"?F.useEffect:F.useLayoutEffect;function mr(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),i=Object.keys(t.methods||{}),l=Object.keys(t.events||{}),c=F.createContext({});function a(b,f){b.propsReady!==void 0&&$(b.propsReady,!1);for(const h of r){const S=b[t.required[h]];$(S,f[h])}for(const h of o)if(h in f){const S=b[t.optional[h]];$(S,f[h])}b.propsReady!==void 0&&$(b.propsReady,!0)}function u(b){return i.reduce((f,h)=>(f[h]=S=>{const N=b[t.methods[h]];$(N,S)},f),{})}function d(b){return l.reduce((f,h)=>(f[h]=ao(b[t.events[h]]),f),{})}const m=F.forwardRef(function(b,f){const{children:h,...S}=b,[N]=F.useState(()=>yt(uo(e),p=>{a(p,S)})),[I]=F.useState(gn(d,N));xt(()=>{for(const p of l)p in S&&Z(I[p],S[p]);return()=>{Object.values(I).map(Yt)}},[S,I,N]),xt(()=>{a(N,S)}),F.useImperativeHandle(f,hn(u(N)));const D=n;return s.jsx(c.Provider,{value:N,children:n===void 0?h:s.jsx(D,{...Yo([...r,...o,...l],S),children:h})})}),g=b=>{const f=F.useContext(c);return F.useCallback(h=>{$(f[b],h)},[f,b])},x=b=>{const f=F.useContext(c)[b],h=F.useCallback(S=>Z(f,S),[f]);return F.useSyncExternalStore(h,()=>oe(f),()=>oe(f))},E=b=>{const f=F.useContext(c)[b],[h,S]=F.useState(gn(oe,f));return xt(()=>Z(f,N=>{N!==h&&S(hn(N))}),[f,h]),h},k=parseInt(F.version,10)>=18?x:E;return{Component:m,useEmitter:(b,f)=>{const h=F.useContext(c)[b];xt(()=>Z(h,f),[f,h])},useEmitterValue:k,usePublisher:g}}const hr=F.createContext(void 0),gr=F.createContext(void 0),Ot="-webkit-sticky",Rn="sticky",nn=pr(()=>{if(typeof document>"u")return Rn;const e=document.createElement("div");return e.style.position=Ot,e.style.position===Ot?Ot:Rn}),xr=typeof document>"u"?F.useEffect:F.useLayoutEffect;function Lt(e){return"self"in e}function Xo(e){return"body"in e}function br(e,t,n,r=Je,o,i){const l=F.useRef(null),c=F.useRef(null),a=F.useRef(null),u=F.useCallback(g=>{let x,E,k;const b=g.target;if(Xo(b)||Lt(b)){const h=Lt(b)?b:b.defaultView;k=i===!0?Pe(h,h.scrollX):h.scrollY,x=i===!0?h.document.documentElement.scrollWidth:h.document.documentElement.scrollHeight,E=i===!0?h.innerWidth:h.innerHeight}else k=i===!0?Pe(b,b.scrollLeft):b.scrollTop,x=i===!0?b.scrollWidth:b.scrollHeight,E=i===!0?b.offsetWidth:b.offsetHeight;const f=()=>{e({scrollHeight:x,scrollTop:Math.max(k,0),viewportHeight:E})};g.suppressFlushSync===!0?f():Vr.flushSync(f),c.current!==null&&(k===c.current||k<=0||k===x-E)&&(c.current=null,t(!0),a.current&&(clearTimeout(a.current),a.current=null))},[e,t,i]);F.useEffect(()=>{const g=o??l.current;return bn(g),r(o??l.current),u({suppressFlushSync:!0,target:g}),g.addEventListener("scroll",u,{passive:!0}),()=>{bn(g),r(null),g.removeEventListener("scroll",u)}},[l,u,n,r,o]);function d(g){const x=l.current;if(!x||(i===!0?"offsetWidth"in x&&x.offsetWidth===0:"offsetHeight"in x&&x.offsetHeight===0))return;const E=g.behavior==="smooth";let k,b,f;Lt(x)?(b=Math.max(He(x.document.documentElement,i===!0?"width":"height"),i===!0?x.document.documentElement.scrollWidth:x.document.documentElement.scrollHeight),k=i===!0?x.innerWidth:x.innerHeight,f=i===!0?Pe(x,x.scrollX):x.scrollY):(b=x[i===!0?"scrollWidth":"scrollHeight"],k=He(x,i===!0?"width":"height"),f=i===!0?Pe(x,x.scrollLeft):x.scrollTop);const h=b-k;if(g.top===void 0){x.scrollTo(g);return}const S=Math.ceil(Math.max(Math.min(h,g.top),0));if(g.top=S,ir(k,b)||S===f){e({scrollHeight:b,scrollTop:f,viewportHeight:k}),E&&t(!0);return}E?(c.current=S,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,c.current=null,t(!0)},1e3)):c.current=null,i===!0&&(g={...g.behavior===void 0?{}:{behavior:g.behavior},left:vn(x,S)}),x.scrollTo(g)}function m(g){i===!0&&(g={...g.behavior===void 0?{}:{behavior:g.behavior},...g.top===void 0?{}:{left:vn(l.current,g.top)}}),l.current.scrollBy(g)}return{scrollByCallback:m,scrollerRef:l,scrollToCallback:d}}function rn(e){return e}const Zo=Y(()=>{const e=y(c=>`Item ${c}`),t=y(c=>`Group ${c}`),n=y({}),r=y(rn),o=y("div"),i=y(Je),l=(c,a=null)=>xe(T(n,O(u=>u[c]),te()),a);return{components:n,computeItemKey:r,EmptyPlaceholder:l("EmptyPlaceholder"),FooterComponent:l("Footer"),GroupComponent:l("Group","div"),groupContent:t,HeaderComponent:l("Header"),HeaderFooterTag:o,ItemComponent:l("Item","div"),itemContent:e,ListComponent:l("List","div"),ScrollerComponent:l("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TopItemListComponent:l("TopItemList")}}),Jo=Y(([e,t])=>({...e,...t}),ne(fr,Zo)),Qo=({height:e})=>s.jsx("div",{style:{height:e}}),qo={overflowAnchor:"none",position:nn(),zIndex:1},vr={overflowAnchor:"none"},es={...vr,display:"inline-block",height:"100%"},An=F.memo(function({showTopList:e=!1}){const t=P("listState"),n=we("sizeRanges"),r=P("useWindowScroll"),o=P("customScrollParent"),i=we("windowScrollContainerState"),l=we("scrollContainerState"),c=o||r?i:l,a=P("itemContent"),u=P("context"),d=P("groupContent"),m=P("trackItemSizes"),g=P("itemSize"),x=P("log"),E=we("gap"),k=P("horizontalDirection"),{callbackRef:b}=ho(n,g,m,e?Je:c,x,E,o,k,P("skipAnimationFrameInResizeObserver")),[f,h]=F.useState(0);sn("deviation",z=>{f!==z&&h(z)});const S=P("EmptyPlaceholder"),N=P("ScrollSeekPlaceholder")??Qo,I=P("ListComponent"),D=P("ItemComponent"),p=P("GroupComponent"),v=P("computeItemKey"),C=P("isSeeking"),w=P("groupIndices").length>0,A=P("alignToBottom"),_=P("initialItemFinalLocationReached"),L=e?{}:{boxSizing:"border-box",...k?{display:"inline-block",height:"100%",marginInlineStart:f===0?A?"auto":0:f,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:"nowrap"}:{marginTop:f===0?A?"auto":0:f,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},..._?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&S!==null&&S!==void 0?s.jsx(S,{...ge(S,u)}):s.jsx(I,{...ge(I,u),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:b,style:L,children:(e?t.topItems:t.items).map(z=>{const G=z.originalIndex,K=v(G+t.firstItemIndex,z.data,u);return C?R.createElement(N,{...ge(N,u),height:z.size,index:z.index,key:K,type:z.type||"item",...z.type==="group"?{}:{groupIndex:z.groupIndex}}):z.type==="group"?R.createElement(p,{...ge(p,u),"data-index":G,"data-item-index":z.index,"data-known-size":z.size,key:K,style:qo},d(z.index,u)):R.createElement(D,{...ge(D,u),...os(D,z.data),"data-index":G,"data-item-group-index":z.groupIndex,"data-item-index":z.index,"data-known-size":z.size,key:K,style:k?es:vr},w?a(z.index,z.groupIndex,z.data,u):a(z.index,z.data,u))})})}),ts={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},ns={outline:"none",overflowX:"auto",position:"relative"},on=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),Sr=(e,t,n=0)=>({...on(e),position:t?"relative":"absolute",top:t?-n:0}),rs={position:nn(),top:0,width:"100%",zIndex:1};function ge(e,t){if(typeof e!="string")return{context:t}}function os(e,t){return{item:typeof e=="string"?void 0:t}}const ss=F.memo(function(){const e=P("HeaderComponent"),t=we("headerHeight"),n=P("HeaderFooterTag"),r=Ge(F.useMemo(()=>i=>{t(He(i,"height"))},[t]),!0,P("skipAnimationFrameInResizeObserver")),o=P("context");return e!=null?s.jsx(n,{ref:r,children:s.jsx(e,{...ge(e,o)})}):null}),is=F.memo(function(){const e=P("FooterComponent"),t=we("footerHeight"),n=P("HeaderFooterTag"),r=Ge(F.useMemo(()=>i=>{t(He(i,"height"))},[t]),!0,P("skipAnimationFrameInResizeObserver")),o=P("context");return e!=null?s.jsx(n,{ref:r,children:s.jsx(e,{...ge(e,o)})}):null});function Ir({useEmitter:e,useEmitterValue:t,usePublisher:n}){return F.memo(function({children:r,style:o,context:i,...l}){const c=n("scrollContainerState"),a=t("ScrollerComponent"),u=n("smoothScrollTargetReached"),d=t("scrollerRef"),m=t("horizontalDirection")||!1,{scrollByCallback:g,scrollerRef:x,scrollToCallback:E}=br(c,u,a,d,void 0,m);return e("scrollTo",E),e("scrollBy",g),s.jsx(a,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:x,style:{...m?ns:ts,...o},tabIndex:0,...l,...ge(a,i),children:r})})}function Tr({useEmitter:e,useEmitterValue:t,usePublisher:n}){return F.memo(function({children:r,style:o,context:i,...l}){const c=n("windowScrollContainerState"),a=t("ScrollerComponent"),u=n("smoothScrollTargetReached"),d=t("totalListHeight"),m=t("deviation"),g=t("customScrollParent"),x=F.useRef(null),E=t("scrollerRef"),{scrollByCallback:k,scrollerRef:b,scrollToCallback:f}=br(c,u,a,E,g);return xr(()=>{var h;return b.current=g??((h=x.current)==null?void 0:h.ownerDocument.defaultView),()=>{b.current=null}},[b,g]),e("windowScrollTo",f),e("scrollBy",k),s.jsx(a,{ref:x,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...d===0?void 0:{height:d+m}},...l,...ge(a,i),children:r})})}const as=({children:e})=>{const t=F.useContext(hr),n=we("viewportHeight"),r=we("fixedItemHeight"),o=P("alignToBottom"),i=P("horizontalDirection"),l=F.useMemo(()=>Gn(n,a=>He(a,i?"width":"height")),[n,i]),c=Ge(l,!0,P("skipAnimationFrameInResizeObserver"));return F.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),s.jsx("div",{"data-viewport-type":"element",ref:c,style:on(o),children:e})},ls=({children:e})=>{const t=F.useContext(hr),n=we("windowViewportRect"),r=we("fixedItemHeight"),o=P("customScrollParent"),i=P("useWindowScroll"),l=P("topListHeight"),c=Yn(n,o,P("skipAnimationFrameInResizeObserver")),a=P("alignToBottom");return F.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),s.jsx("div",{"data-viewport-type":"window",ref:c,style:Sr(a,i,l),children:e})},cs=({children:e})=>{const t=P("TopItemListComponent")??"div",n=P("headerHeight"),r={...rs,marginTop:`${n}px`},o=P("context");return s.jsx(t,{style:r,...ge(t,o),children:e})},us=F.memo(function(e){const t=P("useWindowScroll"),n=P("topItemsIndexes").length>0,r=P("customScrollParent"),o=P("context");return s.jsxs(r||t?fs:ps,{...e,context:o,children:[n&&s.jsx(cs,{children:s.jsx(An,{showTopList:!0})}),s.jsxs(r||t?ls:as,{children:[s.jsx(ss,{}),s.jsx(An,{}),s.jsx(is,{})]})]})}),{Component:ds,useEmitter:sn,useEmitterValue:P,usePublisher:we}=mr(Jo,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},us),ps=Ir({useEmitter:sn,useEmitterValue:P,usePublisher:we}),fs=Tr({useEmitter:sn,useEmitterValue:P,usePublisher:we}),ms=ds,hs=Y(()=>{const e=y(u=>s.jsxs("td",{children:["Item $",u]})),t=y(null),n=y(u=>s.jsxs("td",{colSpan:1e3,children:["Group ",u]})),r=y(null),o=y(null),i=y({}),l=y(rn),c=y(Je),a=(u,d=null)=>xe(T(i,O(m=>m[u]),te()),d);return{components:i,computeItemKey:l,context:t,EmptyPlaceholder:a("EmptyPlaceholder"),FillerRow:a("FillerRow"),fixedFooterContent:o,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:a("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TableBodyComponent:a("TableBody","tbody"),TableComponent:a("Table","table"),TableFooterComponent:a("TableFoot","tfoot"),TableHeadComponent:a("TableHead","thead"),TableRowComponent:a("TableRow","tr"),GroupComponent:a("Group","tr")}});ne(fr,hs);nn();const jn={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},gs={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:On,floor:wt,max:nt,min:Ft,round:Ln}=Math;function Fn(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>({data:n===null?null:n[o+e],index:o+e}))}function xs(e){return{...gs,items:e}}function bt(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function bs(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const vs=Y(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:i,scrollBy:l,scrollContainerState:c,scrollTo:a,scrollTop:u,smoothScrollTargetReached:d,viewportHeight:m},g,x,{didMount:E,propsReady:k},{customScrollParent:b,useWindowScroll:f,windowScrollContainerState:h,windowScrollTo:S,windowViewportRect:N},I])=>{const D=y(0),p=y(0),v=y(jn),C=y({height:0,width:0}),w=y({height:0,width:0}),A=W(),_=W(),L=y(0),z=y(null),G=y({column:0,row:0}),K=W(),V=W(),ce=y(!1),Ee=y(0),me=y(!0),Se=y(!1),Fe=y(!1);Z(T(E,U(Ee),B(([j,X])=>!Gt(X))),()=>{$(me,!1)}),Z(T(le(E,me,w,C,Ee,Se),B(([j,X,ue,q,,re])=>j&&!X&&ue.height!==0&&q.height!==0&&!re)),([,,,,j])=>{if(j===void 0){$(me,!0);return}$(Se,!0),Qt(1,()=>{$(A,j)}),Ne(T(u),()=>{$(t,[0,0]),$(me,!0)})}),H(T(V,B(j=>j!=null&&j.scrollTop>0),Ae(0)),p),Z(T(E,U(V),B(([,j])=>j!=null)),([,j])=>{j&&($(C,j.viewport),$(w,j.item),$(G,j.gap),j.scrollTop>0&&($(ce,!0),Ne(T(u,Ue(1)),X=>{$(ce,!1)}),$(a,{top:j.scrollTop})))}),H(T(C,O(({height:j})=>j)),m),H(T(le(M(C,bt),M(w,bt),M(G,(j,X)=>j!==void 0&&j.column===X.column&&j.row===X.row),M(u)),O(([j,X,ue,q])=>({gap:ue,item:X,scrollTop:q,viewport:j}))),K),H(T(le(M(D),r,M(G,bs),M(w,bt),M(C,bt),M(z),M(p),M(ce),M(me),M(Ee)),B(([,,,,,,,j])=>!j),O(([j,[X,ue],q,re,de,ie,Q,,se,be])=>{const{column:ae,row:et}=q,{height:mt,width:Ct}=re,{width:an}=de;if(Q===0&&(j===0||an===0))return jn;if(Ct===0){const pn=qt(be,j),Ar=pn+Math.max(Q-1,0);return xs(Fn(pn,Ar,ie))}const ht=Er(an,Ct,ae);let Ke,_e;se?X===0&&ue===0&&Q>0?(Ke=0,_e=Q-1):(Ke=ht*wt((X+et)/(mt+et)),_e=ht*On((ue+et)/(mt+et))-1,_e=Ft(j-1,nt(_e,ht-1)),Ke=Ft(_e,nt(0,Ke))):(Ke=0,_e=-1);const ln=Fn(Ke,_e,ie),{bottom:cn,top:un}=Hn(de,q,re,ln),dn=On(j/ht),Rr=dn*mt+(dn-1)*et-cn;return{bottom:cn,itemHeight:mt,items:ln,itemWidth:Ct,offsetBottom:Rr,offsetTop:un,top:un}})),v),H(T(z,B(j=>j!==null),O(j=>j.length)),D),H(T(le(C,w,v,G),B(([j,X,{items:ue}])=>ue.length>0&&X.height!==0&&j.height!==0),O(([j,X,{items:ue},q])=>{const{bottom:re,top:de}=Hn(j,q,X,ue);return[de,re]}),te(it)),t);const he=y(!1);H(T(u,U(he),O(([j,X])=>X||j!==0)),he);const Ve=Te(T(le(v,D),B(([{items:j}])=>j.length>0),U(he),B(([[j,X],ue])=>{const q=j.items[j.items.length-1].index===X-1;return(ue||j.bottom>0&&j.itemHeight>0&&j.offsetBottom===0&&j.items.length===X)&&q}),O(([[,j]])=>j-1),te())),Qe=Te(T(M(v),B(({items:j})=>j.length>0&&j[0].index===0),Ae(0),te())),Re=Te(T(M(v),U(ce),B(([{items:j},X])=>j.length>0&&!X),O(([{items:j}])=>({endIndex:j[j.length-1].index,startIndex:j[0].index})),te(er),Le(0)));H(Re,x.scrollSeekRangeChanged),H(T(A,U(C,w,D,G),O(([j,X,ue,q,re])=>{const de=sr(j),{align:ie,behavior:Q,offset:se}=de;let be=de.index;be==="LAST"&&(be=q-1),be=nt(0,be,Ft(q-1,be));let ae=Wt(X,re,ue,be);return ie==="end"?ae=Ln(ae-X.height+ue.height):ie==="center"&&(ae=Ln(ae-X.height/2+ue.height/2)),se!==void 0&&se!==0&&(ae+=se),{behavior:Q,top:ae}})),a);const qe=xe(T(v,O(j=>j.offsetBottom+j.bottom)),0);return H(T(N,O(j=>({height:j.visibleHeight,width:j.visibleWidth}))),C),{customScrollParent:b,data:z,deviation:L,footerHeight:o,gap:G,headerHeight:i,increaseViewportBy:e,initialItemCount:p,itemDimensions:w,overscan:n,restoreStateFrom:V,scrollBy:l,scrollContainerState:c,scrollHeight:_,scrollTo:a,scrollToIndex:A,scrollTop:u,smoothScrollTargetReached:d,totalCount:D,useWindowScroll:f,viewportDimensions:C,windowScrollContainerState:h,windowScrollTo:S,windowViewportRect:N,...x,gridState:v,horizontalDirection:Fe,initialTopMostItemIndex:Ee,totalListHeight:qe,...g,endReached:Ve,propsReady:k,rangeChanged:Re,startReached:Qe,stateChanged:K,stateRestoreInProgress:ce,...I}},ne(en,ve,ft,dr,Be,tn,Me));function Er(e,t,n){return nt(1,wt((e+n)/(wt(t)+n)))}function Hn(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{bottom:0,top:0};const i=Wt(e,t,n,r[0].index);return{bottom:Wt(e,t,n,r[r.length-1].index)+o,top:i}}function Wt(e,t,n,r){const o=Er(e.width,n.width,t.column),i=wt(r/o),l=i*n.height+nt(0,i-1)*t.row;return l>0?l+t.row:l}const Ss=Y(()=>{const e=y(m=>`Item ${m}`),t=y({}),n=y(null),r=y("virtuoso-grid-item"),o=y("virtuoso-grid-list"),i=y(rn),l=y("div"),c=y(Je),a=(m,g=null)=>xe(T(t,O(x=>x[m]),te()),g),u=y(!1),d=y(!1);return H(M(d),u),{components:t,computeItemKey:i,context:n,FooterComponent:a("Footer"),HeaderComponent:a("Header"),headerFooterTag:l,itemClassName:r,ItemComponent:a("Item","div"),itemContent:e,listClassName:o,ListComponent:a("List","div"),readyStateChanged:u,reportReadyState:d,ScrollerComponent:a("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder","div")}}),Is=Y(([e,t])=>({...e,...t}),ne(vs,Ss)),Ts=F.memo(function(){const e=ee("gridState"),t=ee("listClassName"),n=ee("itemClassName"),r=ee("itemContent"),o=ee("computeItemKey"),i=ee("isSeeking"),l=ke("scrollHeight"),c=ee("ItemComponent"),a=ee("ListComponent"),u=ee("ScrollSeekPlaceholder"),d=ee("context"),m=ke("itemDimensions"),g=ke("gap"),x=ee("log"),E=ee("stateRestoreInProgress"),k=ke("reportReadyState"),b=Ge(F.useMemo(()=>f=>{const h=f.parentElement.parentElement.scrollHeight;l(h);const S=f.firstChild;if(S!==null){const{height:N,width:I}=S.getBoundingClientRect();m({height:N,width:I})}g({column:Dn("column-gap",getComputedStyle(f).columnGap,x),row:Dn("row-gap",getComputedStyle(f).rowGap,x)})},[l,m,g,x]),!0,!1);return xr(()=>{e.itemHeight>0&&e.itemWidth>0&&k(!0)},[e]),E?null:s.jsx(a,{className:t,ref:b,...ge(a,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(f=>{const h=o(f.index,f.data,d);return i?s.jsx(u,{...ge(u,d),height:e.itemHeight,index:f.index,width:e.itemWidth},h):R.createElement(c,{...ge(c,d),className:n,"data-index":f.index,key:h},r(f.index,f.data,d))})})}),Es=F.memo(function(){const e=ee("HeaderComponent"),t=ke("headerHeight"),n=ee("headerFooterTag"),r=Ge(F.useMemo(()=>i=>{t(He(i,"height"))},[t]),!0,!1),o=ee("context");return e!=null?s.jsx(n,{ref:r,children:s.jsx(e,{...ge(e,o)})}):null}),ws=F.memo(function(){const e=ee("FooterComponent"),t=ke("footerHeight"),n=ee("headerFooterTag"),r=Ge(F.useMemo(()=>i=>{t(He(i,"height"))},[t]),!0,!1),o=ee("context");return e!=null?s.jsx(n,{ref:r,children:s.jsx(e,{...ge(e,o)})}):null}),ks=({children:e})=>{const t=F.useContext(gr),n=ke("itemDimensions"),r=ke("viewportDimensions"),o=Ge(F.useMemo(()=>i=>{r(i.getBoundingClientRect())},[r]),!0,!1);return F.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),s.jsx("div",{ref:o,style:on(!1),children:e})},ys=({children:e})=>{const t=F.useContext(gr),n=ke("windowViewportRect"),r=ke("itemDimensions"),o=ee("customScrollParent"),i=ee("useWindowScroll"),l=Yn(n,o,!1);return F.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),s.jsx("div",{ref:l,style:Sr(!1,i),children:e})},Ns=F.memo(function({...e}){const t=ee("useWindowScroll"),n=ee("customScrollParent"),r=n||t?Rs:Cs,o=n||t?ys:ks,i=ee("context");return s.jsx(r,{...e,...ge(r,i),children:s.jsxs(o,{children:[s.jsx(Es,{}),s.jsx(Ts,{}),s.jsx(ws,{})]})})}),{useEmitter:wr,useEmitterValue:ee,usePublisher:ke}=mr(Is,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Ns),Cs=Ir({useEmitter:wr,useEmitterValue:ee,usePublisher:ke}),Rs=Tr({useEmitter:wr,useEmitterValue:ee,usePublisher:ke});function Dn(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,fe.WARN),t==="normal"?0:parseInt(t??"0",10)}Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript})(Prism);(function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,o=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function i(a,u){return a=a.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return o}),RegExp(a,u)}o=i(o).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=i(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:i(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:i(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var l=function(a){return a?typeof a=="string"?a:typeof a.content=="string"?a.content:a.content.map(l).join(""):""},c=function(a){for(var u=[],d=0;d<a.length;d++){var m=a[d],g=!1;if(typeof m!="string"&&(m.type==="tag"&&m.content[0]&&m.content[0].type==="tag"?m.content[0].content[0].content==="</"?u.length>0&&u[u.length-1].tagName===l(m.content[0].content[1])&&u.pop():m.content[m.content.length-1].content==="/>"||u.push({tagName:l(m.content[0].content[1]),openedBraces:0}):u.length>0&&m.type==="punctuation"&&m.content==="{"?u[u.length-1].openedBraces++:u.length>0&&u[u.length-1].openedBraces>0&&m.type==="punctuation"&&m.content==="}"?u[u.length-1].openedBraces--:g=!0),(g||typeof m=="string")&&u.length>0&&u[u.length-1].openedBraces===0){var x=l(m);d<a.length-1&&(typeof a[d+1]=="string"||a[d+1].type==="plain-text")&&(x+=l(a[d+1]),a.splice(d+1,1)),d>0&&(typeof a[d-1]=="string"||a[d-1].type==="plain-text")&&(x=l(a[d-1])+x,a.splice(d-1,1),d--),a[d]=new e.Token("plain-text",x,null,x)}m.content&&typeof m.content!="string"&&c(m.content)}};e.hooks.add("after-tokenize",function(a){a.language!=="jsx"&&a.language!=="tsx"||c(a.tokens)})})(Prism);(function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var n=e.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0})(Prism);(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var o=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],i=r.variable[1].inside,l=0;l<o.length;l++)i[o[l]]=e.languages.bash[o[l]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;(function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(d){return d=d.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+d+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+i+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+i+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(d){["url","bold","italic","strike","code-snippet"].forEach(function(m){d!==m&&(e.languages.markdown[d].inside.content.inside[m]=e.languages.markdown[m])})}),e.hooks.add("after-tokenize",function(d){if(d.language!=="markdown"&&d.language!=="md")return;function m(g){if(!(!g||typeof g=="string"))for(var x=0,E=g.length;x<E;x++){var k=g[x];if(k.type!=="code"){m(k.content);continue}var b=k.content[1],f=k.content[3];if(b&&f&&b.type==="code-language"&&f.type==="code-block"&&typeof b.content=="string"){var h=b.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");h=(/[a-z][\w-]*/i.exec(h)||[""])[0].toLowerCase();var S="language-"+h;f.alias?typeof f.alias=="string"?f.alias=[f.alias,S]:f.alias.push(S):f.alias=[S]}}}m(d.tokens)}),e.hooks.add("wrap",function(d){if(d.type==="code-block"){for(var m="",g=0,x=d.classes.length;g<x;g++){var E=d.classes[g],k=/language-(.+)/.exec(E);if(k){m=k[1];break}}var b=e.languages[m];if(b)d.content=e.highlight(u(d.content),b,m);else if(m&&m!=="none"&&e.plugins.autoloader){var f="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);d.attributes.id=f,e.plugins.autoloader.loadLanguages(m,function(){var h=document.getElementById(f);h&&(h.innerHTML=e.highlight(h.textContent,e.languages[m],m))})}}});var l=RegExp(e.languages.markup.tag.pattern.source,"gi"),c={amp:"&",lt:"<",gt:">",quot:'"'},a=String.fromCodePoint||String.fromCharCode;function u(d){var m=d.replace(l,"");return m=m.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(g,x){if(x=x.toLowerCase(),x[0]==="#"){var E;return x[1]==="x"?E=parseInt(x.slice(2),16):E=Number(x.slice(1)),a(E)}else{var k=c[x];return k||g}}),m}e.languages.md=e.languages.markdown})(Prism);(function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+n.source+")?)",o=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),i=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function l(c,a){a=(a||"").replace(/m/g,"")+"m";var u=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return c});return RegExp(u,a)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+o+"|"+i+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:l(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:l(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:l(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:l(i),lookbehind:!0,greedy:!0},number:{pattern:l(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml})(Prism);Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};const As={js:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",py:"Python",python:"Python",bash:"Bash",shell:"Shell",css:"CSS",json:"JSON",yaml:"YAML",yml:"YAML",sql:"SQL",md:"Markdown",markdown:"Markdown",xml:"XML",html:"HTML"};function js({language:e,code:t}){const[n,r]=R.useState(!1),o=R.useRef(null);R.useEffect(()=>{o.current&&Or.highlightElement(o.current)},[t,e]);const i=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}catch(c){console.error("Failed to copy:",c)}},l=As[e]||e.toUpperCase();return s.jsxs("div",{className:"relative group rounded-lg overflow-hidden border border-dark-border my-2",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-dark-surface border-b border-dark-border",children:[s.jsx("span",{className:"text-xs text-dark-muted font-mono",children:l}),s.jsx("button",{onClick:i,className:"flex items-center gap-1 text-xs px-2 py-1 rounded hover:bg-dark-hover transition-colors",children:n?s.jsxs(s.Fragment,{children:[s.jsx(Lr,{size:12,className:"text-accent-green"}),s.jsx("span",{className:"text-accent-green",children:"已复制"})]}):s.jsxs(s.Fragment,{children:[s.jsx(_n,{size:12}),s.jsx("span",{children:"复制"})]})})]}),s.jsx("pre",{className:"bg-dark-bg p-3 overflow-x-auto custom-scrollbar text-sm",children:s.jsx("code",{ref:o,className:`language-${e}`,children:t})})]})}function Os({content:e,className:t=""}){const[n,r]=R.useState(e),o=R.useRef(0),i=R.useRef(null),l=R.useRef(e);l.current=e,R.useEffect(()=>{if(e===n)return;const a=Date.now(),u=a-o.current;u>=200?(r(e),o.current=a):i.current||(i.current=setTimeout(()=>{i.current=null,r(l.current),o.current=Date.now()},200-u))},[e]),R.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const c=(n||"").replace(/\\n/g,`
2
+ `).replace(/\n{3,}/g,`
3
+
4
+ `);return s.jsx("div",{className:`markdown-content ${t}`,style:{wordBreak:"break-word"},children:s.jsx(jr,{components:{code({className:a,children:u,...d}){const m=/language-(\w+)/.exec(a||""),g=String(u).replace(/\n$/,"");return m&&m[1]?s.jsx(js,{language:m[1],code:g}):s.jsx("code",{className:"bg-dark-hover px-1.5 py-0.5 rounded text-sm font-mono text-accent-blue",...d,children:u})},a({href:a,children:u}){return s.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"text-accent-blue hover:underline",children:u})},table({children:a}){return s.jsx("div",{className:"overflow-x-auto custom-scrollbar my-2",children:s.jsx("table",{className:"w-full border-collapse border border-dark-border",children:a})})},th({children:a}){return s.jsx("th",{className:"border border-dark-border px-3 py-2 text-left bg-dark-hover font-medium",children:a})},td({children:a}){return s.jsx("td",{className:"border border-dark-border px-3 py-2",children:a})},p({children:a}){return s.jsx("p",{className:"mb-0.5 leading-snug last:mb-0",children:a})},blockquote({children:a}){return s.jsx("blockquote",{className:"border-l-4 border-accent-blue pl-3 my-1 text-dark-muted italic",children:a})},h1({children:a}){return s.jsx("h1",{className:"text-2xl font-bold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:a})},h2({children:a}){return s.jsx("h2",{className:"text-xl font-semibold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:a})},h3({children:a}){return s.jsx("h3",{className:"text-lg font-semibold mt-2 mb-1 text-dark-text",children:a})}},children:c})})}const Ls=R.memo(function({filePath:t,content:n,language:r}){if(!n&&!t)return null;const[o,i]=R.useState("unified"),[l,c]=R.useState(!1),a=Fs(t,r),u=(n==null?void 0:n.includes("@@"))||(n==null?void 0:n.includes("+++"))||(n==null?void 0:n.includes("---")),d=u?Hs(n||""):null;return s.jsxs("div",{className:"mt-2 border border-dark-border rounded-lg overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-dark-surface border-b border-dark-border",children:[s.jsx("span",{className:"text-accent-purple text-xs",children:"📝"}),s.jsx("span",{className:"text-xs font-mono text-dark-fg truncate",children:t||"file"}),d&&s.jsxs("span",{className:"text-xs ml-2 flex gap-2",children:[s.jsxs("span",{className:"text-green-400",children:["+",d.additions]}),s.jsxs("span",{className:"text-red-400",children:["-",d.deletions]})]}),s.jsx("span",{className:"text-xs text-dark-muted ml-auto",children:a}),u&&s.jsxs("div",{className:"flex gap-0.5 ml-2",children:[s.jsx("button",{onClick:()=>i("unified"),className:`text-xs px-1.5 py-0.5 rounded ${o==="unified"?"bg-accent-blue/20 text-accent-blue":"text-dark-muted hover:text-dark-fg"}`,title:"Unified view",children:"Unified"}),s.jsx("button",{onClick:()=>i("side-by-side"),className:`text-xs px-1.5 py-0.5 rounded ${o==="side-by-side"?"bg-accent-blue/20 text-accent-blue":"text-dark-muted hover:text-dark-fg"}`,title:"Side-by-side view",children:"Side"})]}),s.jsx("button",{onClick:()=>c(!l),className:"text-xs text-dark-muted hover:text-dark-fg ml-1",children:l?"▶":"▼"})]}),!l&&s.jsxs("div",{className:"bg-dark-bg overflow-x-auto max-h-96 overflow-y-auto custom-scrollbar",children:[u?o==="unified"?Ds(n||""):zs(n||""):s.jsx("pre",{className:"text-xs font-mono p-2 text-dark-fg whitespace-pre-wrap",children:n||"(no content)"}),d&&s.jsxs("div",{className:"sticky bottom-0 bg-dark-surface border-t border-dark-border px-3 py-1 flex gap-4 text-xs text-dark-muted",children:[s.jsxs("span",{className:"text-green-400",children:["+",d.additions," additions"]}),s.jsxs("span",{className:"text-red-400",children:["-",d.deletions," deletions"]}),s.jsxs("span",{children:[d.hunks," hunks"]})]})]})]})});function Fs(e,t){var o;if(t)return t;if(!e)return"plaintext";const n=(o=e.split(".").pop())==null?void 0:o.toLowerCase();return{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",py:"python",go:"go",rs:"rust",cpp:"cpp",c:"c",h:"c",css:"css",html:"html",json:"json",xml:"xml",yml:"yaml",yaml:"yaml",md:"markdown",sql:"sql",sh:"bash",ps1:"powershell",properties:"properties",toml:"toml",gradle:"groovy",kt:"kotlin",swift:"swift"}[n||""]||"plaintext"}function Hs(e){const t=e.split(`
5
+ `);let n=0,r=0,o=0;for(const i of t)i.startsWith("@@")?o++:i.startsWith("+")&&!i.startsWith("+++")?n++:i.startsWith("-")&&!i.startsWith("---")&&r++;return{additions:n,deletions:r,hunks:o,filesChanged:1}}function Ds(e){return e.split(`
6
+ `).map((n,r)=>{let o="text-dark-fg",i=" ";return(n.startsWith("+++")||n.startsWith("---"))&&r<3?o="text-dark-muted font-bold text-xs":n.startsWith("+")?(o="text-green-400 bg-green-900/20",i="+"):n.startsWith("-")?(o="text-red-400 bg-red-900/20",i="-"):n.startsWith("@@")&&(o="text-accent-blue font-bold bg-accent-blue/5"),s.jsxs("div",{className:`text-xs font-mono leading-snug px-2 ${o}`,style:{minHeight:"1.25rem"},children:[s.jsx("span",{className:"select-none inline-block w-4 text-dark-muted text-right mr-1",children:o.includes("text-accent-blue")?"@":i}),n||" "]},`${r}-${n.substring(0,20)}`)})}function zs(e){const t=e.split(`
7
+ `),n=[];let r=null;for(const o of t)o.startsWith("@@")?(r&&Ht(n,r),r={leftLines:[],rightLines:[]},n.push({left:o,right:o,type:"header"})):o.startsWith("---")||o.startsWith("+++")?n.push({left:"",right:o,type:"header"}):o.startsWith("-")&&r?r.leftLines.push(o.substring(1)):o.startsWith("+")&&r?r.rightLines.push(o.substring(1)):r?(Ht(n,r),n.push({left:o,right:o,type:"context"})):n.push({left:o,right:o,type:"context"});return r&&Ht(n,r),s.jsxs("div",{children:[s.jsxs("div",{className:"flex border-b border-dark-border text-xs font-bold text-dark-muted",children:[s.jsx("div",{className:"flex-1 px-2 py-0.5 border-r border-dark-border",children:"Old"}),s.jsx("div",{className:"flex-1 px-2 py-0.5",children:"New"})]}),n.map((o,i)=>s.jsxs("div",{className:"flex",style:{minHeight:"1.25rem"},children:[s.jsx("div",{className:`flex-1 px-2 border-r border-dark-border/30 font-mono text-xs leading-snug ${o.type==="delete"?"bg-red-900/20 text-red-400":o.type==="header"?"bg-accent-blue/5 text-accent-blue":"text-dark-fg"}`,children:o.left||" "}),s.jsx("div",{className:`flex-1 px-2 font-mono text-xs leading-snug ${o.type==="add"?"bg-green-900/20 text-green-400":o.type==="header"?"bg-accent-blue/5 text-accent-blue":"text-dark-fg"}`,children:o.right||" "})]},i))]})}function Ht(e,t){const n=Math.max(t.leftLines.length,t.rightLines.length);for(let r=0;r<n;r++){const o=r<t.leftLines.length?t.leftLines[r]:"",i=r<t.rightLines.length?t.rightLines[r]:"";e.push({left:r<t.leftLines.length?"- "+o:"",right:r<t.rightLines.length?"+ "+i:"",type:r<t.leftLines.length&&r<t.rightLines.length?"context":r<t.leftLines.length?"delete":"add"})}t.leftLines=[],t.rightLines=[]}function kr(e){const t=R.useRef(null),n=R.useRef(0);return R.useEffect(()=>{if(!e){n.current=0;return}n.current=Date.now();const r=t.current;if(!r)return;const o=()=>{const l=Math.floor((Date.now()-n.current)/1e3),c=l>=60?`${Math.floor(l/60)}m ${l%60}s`:`${l}s`;r.textContent=c};o();const i=setInterval(o,1e3);return()=>clearInterval(i)},[e]),t}const Ms=["FileEditTool","FileWriteTool","EditTool","NotebookEditTool","Write","Edit","WriteTool","FileCreateTool"],Bs=/\b(write|edit|save|create|update|modify|patch)\b/i,_s=/\b(read|open|cat|view|list|ls|dir|find|grep|glob|search)\b/i;function Ps(e){return Ms.includes(e)?!0:Bs.test(e)&&!_s.test(e)}function $s(e){return typeof e=="string"?e:e&&typeof e=="object"?JSON.stringify(e,null,2):String(e??"")}function Us(e){if(typeof e!="string"&&e)return e.filePath||e.path||e.file||e.file_path}const yr=R.memo(function({toolCall:t,defaultCollapsed:n=!0}){const[r,o]=R.useState(n),i=t.status==="running",l=kr(i),c=t.result!==void 0&&t.result!==null,a=t.status==="error",u=Ps(t.name),d=c?$s(t.result):"",m=typeof t.args=="object"&&t.args?Us(t.args):void 0,g=t.duration??0,x=g>0?g>=60?`${Math.floor(g/60)}m ${g%60}s`:`${g}s`:"",E=i?"bg-accent-blue":a?"bg-accent-red":"bg-accent-green";return s.jsxs("div",{className:"rounded-lg transition-colors hover:bg-dark-surface/40","data-testid":"toolcall-row",children:[s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 cursor-pointer select-none",onClick:()=>o(!r),children:[i?s.jsx("span",{className:"inline-block w-3 h-3 shrink-0 rounded-full border-2 border-accent-blue border-r-transparent animate-spin"}):s.jsx("span",{className:`w-2 h-2 shrink-0 rounded-full ${E}`}),s.jsx("span",{className:"text-xs text-dark-muted shrink-0",children:"🔧"}),s.jsx("span",{className:"font-medium text-[13px] text-dark-text truncate",children:t.name}),i&&s.jsxs("span",{className:"text-[11px] text-accent-blue shrink-0 flex items-center gap-1 tabular-nums",children:[s.jsx(rt,{size:10}),s.jsx("span",{ref:l,children:"0s"})]}),!i&&x&&s.jsxs("span",{className:"text-[10px] text-dark-muted shrink-0 flex items-center gap-1 tabular-nums",children:[s.jsx(rt,{size:10}),s.jsx("span",{children:x})]}),s.jsx("span",{className:`ml-auto shrink-0 text-dark-muted/60 transition-transform ${r?"":"rotate-180"}`,children:s.jsx(Tt,{size:13})})]}),!r&&s.jsxs("div",{className:"ml-4 pb-1 pl-3 border-l-2 border-dark-border/30 space-y-1",children:[s.jsxs("div",{className:"py-0.5 px-2",children:[s.jsx("div",{className:"text-[10px] text-dark-muted mb-0.5",children:"参数"}),s.jsx("pre",{className:"text-[11px] font-mono bg-dark-bg border border-dark-border p-2 rounded overflow-x-auto max-h-24 overflow-y-auto custom-scrollbar",children:typeof t.args=="string"?t.args:JSON.stringify(t.args,null,2)})]}),c&&s.jsxs("div",{className:"py-0.5 px-2",children:[s.jsx("div",{className:`text-[10px] mb-0.5 ${a?"text-accent-red":"text-accent-green"}`,children:a?"错误":"结果"}),u&&d?s.jsx(Ls,{filePath:m,content:d}):s.jsx("pre",{className:`text-[11px] font-mono bg-dark-bg border border-dark-border p-2 rounded overflow-x-auto max-h-48 overflow-y-auto custom-scrollbar whitespace-pre-wrap break-all ${a?"text-accent-red":"text-accent-green"}`,children:d})]})]})]})}),Gs=R.memo(function({text:t,maxLength:n=300,preformatted:r=!1}){const[o,i]=R.useState(!1);return t.length>n?s.jsxs("div",{children:[r?s.jsx("pre",{className:"text-xs font-mono bg-dark-bg p-1.5 rounded overflow-x-auto custom-scrollbar mt-1 text-accent-green",children:o?t:t.slice(0,n)+"..."}):s.jsx("div",{className:"text-dark-text leading-snug",children:o?t:t.slice(0,n)+"..."}),s.jsx("button",{onClick:c=>{c.stopPropagation(),i(!o)},className:"mt-1 text-[10px] px-2 py-0.5 rounded bg-dark-hover text-accent-blue hover:bg-dark-border transition-colors",children:o?"收起":"展开"})]}):r?s.jsx("pre",{className:"text-xs font-mono bg-dark-bg p-1.5 rounded overflow-x-auto custom-scrollbar mt-1 text-accent-green",children:t}):s.jsx("div",{className:"text-dark-text leading-snug",children:t})}),Ws=R.memo(function({step:t,defaultCollapsed:n=!0}){const[r,o]=R.useState(n),[i,l]=R.useState(!0),c=t.status==="running",a=kr(c),u=t.description||t.thought||t.result||t.action||t.toolCalls&&t.toolCalls.length>0,d=t.duration??0,m=d>0?d>=60?`${Math.floor(d/60)}m ${d%60}s`:`${d}s`:"",g={pending:"bg-dark-muted/40",running:"bg-accent-blue",success:"bg-accent-green",error:"bg-accent-red",warning:"bg-accent-yellow"}[t.status]||"bg-dark-muted/40";return s.jsxs("div",{className:"rounded-lg transition-colors hover:bg-dark-surface/40","data-testid":"step-row",children:[s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 cursor-pointer select-none",onClick:()=>u&&o(!r),children:[c?s.jsx("span",{className:"inline-block w-3 h-3 shrink-0 rounded-full border-2 border-accent-blue border-r-transparent animate-spin"}):s.jsx("span",{className:`w-2 h-2 shrink-0 rounded-full ${g} ${t.status==="pending"?"opacity-60":""}`}),s.jsx("span",{className:"text-[13px] text-dark-text truncate",children:t.title}),c&&s.jsxs("span",{className:"text-[11px] text-accent-blue shrink-0 flex items-center gap-1 tabular-nums",children:[s.jsx(rt,{size:10}),s.jsx("span",{ref:a,children:"0s"})]}),!c&&m&&s.jsxs("span",{className:"text-[10px] text-dark-muted shrink-0 flex items-center gap-1 tabular-nums",children:[s.jsx(rt,{size:10}),s.jsx("span",{children:m})]}),u&&s.jsx("span",{className:`ml-auto shrink-0 text-dark-muted/60 transition-transform ${r?"":"rotate-180"}`,children:s.jsx(Tt,{size:13})})]}),!r&&u&&s.jsxs("div",{className:"ml-4 pb-1 pl-3 border-l-2 border-dark-border/30 space-y-1",children:[t.description&&s.jsx("div",{className:"text-dark-muted py-0.5 px-2 text-xs",children:t.description}),t.thought&&s.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-blue/40 bg-accent-blue/5 rounded-r",children:[s.jsxs("div",{className:"flex items-center gap-1 text-accent-blue cursor-pointer hover:opacity-80 select-none",onClick:()=>l(!i),children:[i?s.jsx(Vt,{size:12}):s.jsx(Tt,{size:12}),s.jsx("span",{children:"🧠 思考"}),i&&s.jsxs("span",{className:"text-[10px] text-dark-muted truncate max-w-[200px]",children:[t.thought.slice(0,80).replace(/\n/g," "),"..."]})]}),!i&&s.jsx("div",{className:"text-dark-muted italic whitespace-pre-wrap leading-snug mt-1",children:t.thought.replace(/\n\s*\n+/g,`
8
+ `)})]}),t.action&&s.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-yellow/40 bg-accent-yellow/5 rounded-r",children:[s.jsx("div",{className:"flex items-center gap-1 text-accent-yellow mb-0.5",children:"⚡ 执行"}),s.jsx("div",{className:"text-dark-text leading-snug font-mono text-[11px]",children:t.action})]}),t.toolCalls&&t.toolCalls.length>0&&t.toolCalls.map(x=>s.jsx("div",{className:"px-1 py-0.5",children:s.jsx(yr,{toolCall:x})},x.id)),t.result&&s.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-green/40 bg-accent-green/5 rounded-r",children:[s.jsx("div",{className:"flex items-center gap-1 text-accent-green mb-0.5",children:"✓ 结果"}),s.jsx(Gs,{text:t.result,maxLength:500})]})]})]})}),Vs=R.memo(function({steps:t,isGenerating:n}){const{t:r}=De(),[o,i]=R.useState(n),l=R.useRef(n);R.useEffect(()=>{l.current&&!n&&i(!1),l.current=n},[n]);const c=t.length,a=n||t.some(x=>x.status==="running"),u=[...t].reverse().find(x=>x.status==="running"),d=t[t.length-1],m=(u==null?void 0:u.title)||(d==null?void 0:d.title)||"",g=`${c} ${r(c===1?"chat.stepCount":"chat.stepCountPlural")}`;return s.jsxs("div",{className:"mb-1 rounded-lg border border-dark-border/50 transition-colors","data-testid":"turn-group",children:[s.jsxs("button",{className:"flex w-full items-center gap-2 px-2 py-1 text-left cursor-pointer select-none hover:bg-dark-surface/40",onClick:()=>i(!o),"data-testid":"turn-group-toggle",children:[s.jsx("span",{className:"shrink-0 text-dark-muted/60 transition-transform",children:o?s.jsx(Tt,{size:13}):s.jsx(Vt,{size:13})}),a?s.jsx("span",{className:"inline-block w-3 h-3 shrink-0 rounded-full border-2 border-accent-blue border-r-transparent animate-spin"}):s.jsx("span",{className:"w-2 h-2 shrink-0 rounded-full bg-accent-green"}),s.jsx("span",{className:"text-xs text-dark-muted",children:a?`${r("chat.runningSteps")} ${g}…`:g}),a&&m&&s.jsxs("span",{className:"min-w-0 flex-1 truncate pl-1 text-xs text-dark-muted/70",children:["· ",m]})]}),o&&s.jsx("div",{className:"ml-3 pb-1 pl-3 border-l-2 border-dark-border/30 space-y-0.5",children:t.map(x=>s.jsx(Ws,{step:x},x.id))})]})}),Dt=15,Ks=R.memo(function({approval:t,onResolved:n}){const{t:r}=De("hook"),[o,i]=R.useState(!1),[l,c]=R.useState(Dt),a=R.useRef(null),u=t.status==="pending",{level:d,reasonKey:m}=qr(t.toolName,t.askPayload),g=to[d];R.useEffect(()=>{if(u)return c(Dt),a.current=setInterval(()=>{c(I=>I<=1?(a.current&&clearInterval(a.current),0):I-1)},1e3),()=>{a.current&&clearInterval(a.current)}},[u,t.approvalId]),R.useEffect(()=>{l===0&&u&&!o&&E()},[l]);const x=eo(t.toolName,t.askPayload),E=R.useCallback(()=>{!u||o||(i(!0),a.current&&clearInterval(a.current),gt.send({type:"hook_allow",data:JSON.stringify({approvalId:t.approvalId})}),n==null||n(t.approvalId,"approved"))},[u,o,t.approvalId,n]),k=R.useCallback(()=>{!u||o||(i(!0),a.current&&clearInterval(a.current),gt.send({type:"hook_deny",data:JSON.stringify({approvalId:t.approvalId})}),n==null||n(t.approvalId,"denied"))},[u,o,t.approvalId,n]),b=R.useCallback(()=>{if(!u||o)return;i(!0),a.current&&clearInterval(a.current),fn.getState().addToSessionAllowList(t.toolName),gt.send({type:"hook_allow",data:JSON.stringify({approvalId:t.approvalId})}),n==null||n(t.approvalId,"approved")},[u,o,t.approvalId,t.toolName,n]),f=R.useCallback(()=>{!u||o||(i(!0),a.current&&clearInterval(a.current),fn.getState().setAutoMode(!0),vt.getState().setAuto(!0),gt.send({type:"hook_allow",data:JSON.stringify({approvalId:t.approvalId})}),n==null||n(t.approvalId,"approved"))},[u,o,t.approvalId,n]);if(!u){const I=t.status==="approved";return s.jsx("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs ${I?"bg-accent-green/10 border border-accent-green/30 text-accent-green":"bg-accent-red/10 border border-accent-red/30 text-accent-red"}`,children:I?s.jsxs(s.Fragment,{children:[s.jsx(Pn,{size:14}),s.jsxs("span",{children:[r("alreadyAllowed"),t.toolName]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Fr,{size:14}),s.jsxs("span",{children:[r("alreadyDenied"),t.toolName]})]})})}const h=l/Dt*100,S=l<=5,N=[{id:"allow",index:1,label:r("optionAllow"),hint:r("optionAllowHint"),action:E},{id:"deny",index:2,label:r("optionDeny"),hint:r("optionDenyHint"),action:k},{id:"allow_session",index:3,label:r("optionAllowAlways"),hint:r("optionAllowAlwaysHint",{tool:t.toolName}),action:b},{id:"auto_mode",index:4,label:r("optionAutoMode"),hint:r("optionAutoModeHint"),action:f}];return s.jsxs("div",{className:`bg-dark-bg border rounded-lg overflow-hidden ${g.border}`,children:[s.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 ${g.bg} border-b ${g.border}`,children:[s.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold border ${g.badge}`,children:[g.icon," ",d]}),s.jsx(Hr,{size:14,className:g.text}),s.jsx("span",{className:"text-xs font-medium text-dark-text",children:r("permissionRequest")}),s.jsx("span",{className:"text-[10px] text-dark-muted ml-auto",children:r(m)}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-2",children:[s.jsx(rt,{size:11,className:S?"text-accent-red":"text-dark-muted"}),s.jsxs("span",{className:`text-[11px] font-mono ${S?"text-accent-red animate-pulse":"text-dark-muted"}`,children:[l,"s"]}),s.jsx("div",{className:"w-10 h-1 bg-dark-border rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full rounded-full transition-all duration-1000 ${S?"bg-accent-red":l<=8?"bg-accent-yellow":"bg-accent-green"}`,style:{width:`${h}%`}})})]})]}),s.jsxs("div",{className:"px-3 py-2.5 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{className:"text-dark-muted shrink-0",children:r("tool")}),s.jsx("code",{className:"text-accent-blue font-mono text-xs bg-dark-surface px-1.5 py-0.5 rounded",children:t.toolName})]}),x&&s.jsx("div",{className:"bg-dark-surface rounded border border-dark-border p-2 max-h-24 overflow-y-auto custom-scrollbar",children:s.jsx("pre",{className:"text-[11px] font-mono text-dark-text whitespace-pre-wrap break-all leading-relaxed",children:x})}),(d==="CRITICAL"||d==="HIGH")&&s.jsxs("div",{className:`flex items-center gap-1.5 text-[11px] px-2 py-1 rounded ${g.bg} ${g.text}`,children:[s.jsx(Dr,{size:12}),s.jsx("span",{children:r(d==="CRITICAL"?"highRiskWarning":"mediumRiskConfirm")})]}),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"space-y-0.5 pt-1",children:N.map(I=>s.jsxs("button",{onClick:I.action,disabled:o,className:"w-full text-left px-2 py-1.5 rounded hover:bg-dark-hover transition-colors disabled:opacity-50 group",children:[s.jsxs("div",{className:"flex items-baseline gap-1.5",children:[s.jsxs("span",{className:"text-xs text-dark-muted font-mono shrink-0",children:[I.index,"."]}),s.jsx("span",{className:"text-xs text-dark-text group-hover:text-white transition-colors",children:I.label})]}),s.jsx("div",{className:"text-[10px] text-dark-muted/60 ml-5 mt-0.5",children:I.hint})]},I.id))}),s.jsx("div",{className:"text-[10px] text-dark-muted/50 pt-0.5 border-t border-dark-border/50",children:r("clickToSelect")})]})]})]})});function zt({onClick:e,title:t,children:n,danger:r=!1}){return s.jsx("button",{onClick:e,title:t,"aria-label":t,className:`inline-flex items-center justify-center rounded p-1 transition-colors ${r?"text-dark-muted hover:text-accent-red hover:bg-accent-red/10":"text-dark-muted hover:text-dark-text hover:bg-dark-hover"}`,children:n})}function zn({message:e,sessionId:t,onRegenerate:n,onDeleteMessage:r}){const{t:o}=De(),[i,l]=R.useState(!1),c=R.useRef(null);R.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const a=R.useCallback(async()=>{try{await navigator.clipboard.writeText(e.content||e.thinking||""),l(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>l(!1),2e3)}catch(u){console.error("Failed to copy message:",u)}},[e.content,e.thinking]);return t?s.jsxs(s.Fragment,{children:[s.jsx(zt,{onClick:a,title:o("chat.copyMessage"),children:i?s.jsx(Pn,{size:12,className:"text-accent-green"}):s.jsx(_n,{size:12})}),e.type==="assistant"&&n&&s.jsx(zt,{onClick:()=>n(e.id),title:o("chat.regenerate"),children:s.jsx($n,{size:12})}),r&&s.jsx(zt,{onClick:()=>r(e.id),title:o("chat.deleteMessage"),danger:!0,children:s.jsx(zr,{size:12})})]}):null}function Mn({ts:e,align:t,children:n}){const{i18n:r}=De(),o=r.language==="en"?"en-US":"zh-CN";return s.jsx("div",{className:"relative h-0 select-none",children:s.jsxs("div",{className:`absolute top-1 flex items-center gap-0.5 text-[10.5px] leading-none whitespace-nowrap opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity duration-150 ${t==="right"?"right-0":"left-0"}`,children:[n,s.jsx("span",{className:"pl-1 text-[10px] text-dark-muted/50",children:new Date(e).toLocaleTimeString(o,{hour:"2-digit",minute:"2-digit"})})]})})}const Ys=R.memo(function({message:t,sessionId:n,onRegenerate:r,onDeleteMessage:o}){var x,E,k;const{t:i}=De(),l=ye(b=>{var h;if(!n||!b.generatingSessions.includes(n))return!1;const f=b.messagesBySession[n];return f?((h=f[f.length-1])==null?void 0:h.id)===t.id:!1}),[c,a]=R.useState(!0),u=R.useRef(l);R.useEffect(()=>{u.current&&!l&&a(!0),u.current=l},[l]);const d=t.type==="user",m=t.type==="system",g=R.useCallback((b,f)=>{if(!n)return;const S=ye.getState().getMessages(n),N=S.findIndex(v=>v.id===t.id);if(N===-1)return;const I=S[N];if(!I)return;const D={...I,hookApproval:I.hookApproval?{...I.hookApproval,status:f}:void 0},p=[...S];p[N]=D,ye.setState({messagesBySession:{...ye.getState().messagesBySession,[n]:p}})},[n,t.id]);return t.deleted?null:d?s.jsx("div",{className:"group flex justify-end animate-fade-in-up px-1",children:s.jsxs("div",{className:"max-w-[92%] md:max-w-[78%]",children:[s.jsx("div",{className:"rounded-2xl rounded-br-md border border-dark-border/70 bg-dark-surface px-4 py-2.5 shadow-sm",children:s.jsx("div",{className:"text-dark-text whitespace-pre-wrap break-words leading-relaxed text-sm",children:(x=t.content)==null?void 0:x.replace(/\n{3,}/g,`
9
+
10
+ `)})}),s.jsx(Mn,{ts:t.timestamp,align:"right",children:s.jsx(zn,{message:t,sessionId:n,onRegenerate:r,onDeleteMessage:o})})]})}):m?s.jsx("div",{className:"flex justify-center animate-fade-in-up px-1 py-1",children:s.jsx("div",{className:"text-[11px] text-dark-muted bg-dark-surface border border-dark-border/60 rounded-full px-3.5 py-1 max-w-[90%] text-center",children:t.content})}):s.jsx("div",{className:"group flex animate-fade-in-up px-1",children:s.jsxs("div",{className:"w-full max-w-full",children:[s.jsx(Mn,{ts:t.timestamp,align:"left",children:s.jsx(zn,{message:t,sessionId:n,onRegenerate:r,onDeleteMessage:o})}),t.steps&&t.steps.length>0&&!t.hookApproval?s.jsx(Vs,{steps:t.steps,isGenerating:l}):s.jsxs(s.Fragment,{children:[t.thinking&&!t.hookApproval&&s.jsxs("div",{className:"mb-1",children:[s.jsxs("button",{className:"flex items-center gap-1.5 cursor-pointer select-none py-0.5 text-xs",onClick:()=>a(!c),"data-testid":"thinking-toggle",children:[s.jsx(Vt,{size:12,className:`text-dark-muted transition-transform ${c?"":"rotate-90"}`}),s.jsx("span",{className:l?"text-accent-blue/90 animate-pulse":"text-dark-muted",children:l?`${i("chat.thinking")}…`:i("chat.thoughtProcess")})]}),!c&&s.jsx("div",{className:"mt-1 text-xs text-dark-muted whitespace-pre-wrap break-words border-l-2 border-dark-border/40 pl-3 max-h-64 overflow-y-auto custom-scrollbar",children:t.thinking.replace(/\n{3,}/g,`
11
+
12
+ `)})]}),t.toolCalls&&t.toolCalls.length>0&&!t.hookApproval&&s.jsx("div",{className:"mb-1 space-y-0.5",children:t.toolCalls.map(b=>s.jsx(yr,{toolCall:b},b.id))})]}),t.content?s.jsx("div",{className:"leading-relaxed",children:s.jsx(Os,{content:t.content.replace(/\n{3,}/g,`
13
+
14
+ `)})}):!t.thinking&&!t.hookApproval&&((E=t.steps)!=null&&E.length)?null:!t.thinking&&!t.hookApproval&&!((k=t.steps)!=null&&k.length)&&l?s.jsxs("div",{className:"flex items-center gap-3 py-1 text-xs text-dark-muted",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink"}),s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.2s"}}),s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.4s"}})]}),i("chat.thinking"),"..."]}):null,t.hookApproval&&s.jsx("div",{className:"mt-3 border-l-2 border-accent-yellow/50 pl-3",children:s.jsx(Ks,{approval:t.hookApproval,onResolved:g})})]})})}),Xs=R.memo(function({messages:t,isGenerating:n,sessionId:r,onSendSuggestion:o,onRegenerate:i,onDeleteMessage:l}){const{t:c}=De(),a=R.useRef(null),u=R.useRef(n);u.current=n;const[d,m]=R.useState(!0),g=R.useCallback(N=>{const I=N.currentTarget,D=I.scrollHeight-I.scrollTop-I.clientHeight;m(D<50)},[]),x=R.useMemo(()=>F.forwardRef((N,I)=>s.jsx("div",{...N,ref:I,onScroll:g})),[g]);R.useEffect(()=>{n&&(m(!0),requestAnimationFrame(()=>{var N;(N=a.current)==null||N.scrollToIndex({index:"LAST",behavior:"smooth"})}))},[n]);const E=R.useMemo(()=>t.filter(N=>!N.deleted),[t]),k=R.useMemo(()=>(N,I)=>s.jsx("div",{className:"px-4 py-2",children:s.jsx(Ys,{message:I,sessionId:r,onRegenerate:i,onDeleteMessage:l})}),[r,i,l]),b=R.useMemo(()=>()=>n?s.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted py-3 px-5",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink"}),s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.2s"}}),s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.4s"}})]}),s.jsx("span",{children:c("chat.thinkingEllipsis")})]}):null,[n,c]),f=R.useMemo(()=>[{icon:Mr,label:c("chat.suggestionCode"),prompt:c("chat.suggestionCodePrompt")},{icon:Br,label:c("chat.suggestionAnalyze"),prompt:c("chat.suggestionAnalyzePrompt")},{icon:_r,label:c("chat.suggestionAutomate"),prompt:c("chat.suggestionAutomatePrompt")}],[c]),h=R.useMemo(()=>()=>s.jsx("div",{className:"flex min-h-[55vh] items-center justify-center p-6",children:s.jsxs("div",{className:"w-full max-w-xl px-4 text-center",children:[s.jsx("img",{src:"/logo.svg",alt:"deepseekcode",className:"w-14 h-14 mx-auto mb-5 rounded-2xl shadow-md"}),s.jsx("h2",{className:"text-xl font-semibold tracking-tight mb-2",children:c("chat.welcome")}),s.jsx("p",{className:"text-dark-muted text-sm mb-8",children:c("chat.welcomeDesc")}),o&&s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2.5 text-left",children:f.map(N=>s.jsxs("button",{onClick:()=>o(N.prompt),className:"group w-full rounded-xl border border-dark-border bg-dark-surface px-3.5 py-3 text-left transition-all duration-150 hover:border-accent-blue/40 hover:shadow-md hover:-translate-y-px",children:[s.jsx(N.icon,{size:16,"aria-hidden":"true",className:"text-accent-blue mb-2"}),s.jsx("div",{className:"text-[13px] font-medium text-dark-text",children:N.label}),s.jsx("div",{className:"mt-0.5 text-[11px] leading-snug text-dark-muted line-clamp-2",children:N.prompt})]},N.label))})]})}),[c,f,o]),S=R.useMemo(()=>E.length===0?{Scroller:x,Footer:b,Header:h}:{Scroller:x,Footer:b},[x,b,h,E.length]);return s.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:s.jsx(ms,{ref:a,data:E,itemContent:k,followOutput:d?"smooth":void 0,components:S,style:{height:"100%"}})})}),Zs={plan:"border-accent-blue/30 text-accent-blue bg-accent-blue/10","auto-plan":"border-accent-cyan/30 text-accent-cyan bg-accent-cyan/10",act:"border-accent-green/30 text-accent-green bg-accent-green/10","auto-act":"border-accent-yellow/30 text-accent-yellow bg-accent-yellow/10",goal:"border-accent-purple/30 text-accent-purple bg-accent-purple/10","auto-goal":"border-accent-red/30 text-accent-red bg-accent-red/10",normal:"border-accent-green/30 text-accent-green"},Js=R.memo(function(){const{t}=De(),n=vt(a=>a.mode),r=vt(a=>a.setBaseMode),o=vt(a=>a.toggleAuto),i=n==="normal"?"act":n,l=Zr(i),c=Xr(i);return s.jsxs("div",{className:"flex items-center gap-1",children:[Kr.map(a=>{const u=l===a,d=Yr[a],m=n!=="normal"&&u?Zs[n]??"border-dark-border text-dark-muted":"border-dark-border text-dark-muted hover:bg-dark-hover";return s.jsx("button",{type:"button",onClick:()=>r(a),className:Rt("px-2 py-0.5 rounded-full border text-xs whitespace-nowrap transition-colors cursor-pointer",m),title:t("chat.clickToSwitchMode"),"aria-pressed":u,children:d.label},a)}),s.jsxs("button",{type:"button",role:"switch","aria-checked":c,onClick:()=>o(),className:Rt("flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs whitespace-nowrap transition-colors cursor-pointer",c?"border-accent-yellow/40 text-accent-yellow bg-accent-yellow/10":"border-dark-border text-dark-muted hover:bg-dark-hover"),title:t("plan.autoApprove"),children:[s.jsx($n,{size:11,className:Rt(c?"text-accent-yellow":"text-dark-muted")}),s.jsx("span",{children:t("plan.autoApprove")})]})]})}),Qs=800,Bn=/\[Pasted text #(\d+)(?:\s*\+\d+ lines?)?\]/g;let qs=0;const Nr=new Map;function ei(e){const t=++qs;return Nr.set(t,e),t}function ti(e){return e.length>Qs||Cr(e)>0}function Cr(e){return(e.match(/\r\n|\r|\n/g)||[]).length}function ni(e){const t=ei(e),n=Cr(e);return n===0?{id:t,label:`[Pasted text #${t}]`}:{id:t,label:`[Pasted text #${t} +${n} lines]`}}function ri(e){return Bn.lastIndex=0,e.replace(Bn,(t,n)=>{const r=parseInt(n,10),o=Nr.get(r);return o!==void 0?o:t})}const oi=R.memo(function({sessionId:t,onSend:n,onStop:r,onPause:o,onResume:i}){const{t:l}=De(),c=ye(w=>{var A;return((A=w.sessionInputs)==null?void 0:A[t])??""}),a=ye(w=>w.setSessionInput),u=ye(w=>{var A;return((A=w.generatingSessions)==null?void 0:A.includes(t))??!1}),d=ye(w=>{var A;return((A=w.pausedSessions)==null?void 0:A.includes(t))??!1}),m=R.useRef(null),g=R.useRef(!1),x=R.useDeferredValue(c),E=mn(w=>w.estimateTokens),k=R.useMemo(()=>E(x),[x,E]),b=mn(w=>w.model),f=R.useCallback(w=>{a(t,w)},[t,a]),h=R.useCallback(()=>{const w=m.current;w&&(w.style.height="auto",w.style.height=Math.min(w.scrollHeight,200)+"px")},[]);R.useEffect(()=>{h()},[c,h]);const S=R.useCallback(w=>{const A=w.target.value;f(A)},[f]),N=R.useCallback(w=>{const A=w.clipboardData.getData("text/plain");if(!A||!ti(A))return;w.preventDefault();const{label:_}=ni(A),L=m.current;if(!L)return;const z=L.selectionStart,G=L.selectionEnd,K=L.value,V=K.slice(0,z)+_+K.slice(G);f(V),requestAnimationFrame(()=>{L.selectionStart=L.selectionEnd=z+_.length})},[f]),I=R.useCallback(()=>{c.trim()&&(n(ri(c)),f(""))},[c,n,f]),D=R.useCallback(w=>{if(!w.nativeEvent.isComposing){if(w.key==="Escape"&&u){w.preventDefault(),d?i():o();return}if(w.key==="Enter"&&(w.ctrlKey||w.metaKey)){w.preventDefault(),I();return}w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),I())}},[u,d,I,o,i]),p=R.useCallback(()=>{g.current=!0},[]),v=R.useCallback(()=>{g.current=!1},[]),C=k>8e3;return s.jsxs("div",{className:"shrink-0 px-3 sm:px-4 pb-3 pt-2 bg-dark-bg",children:[s.jsxs("div",{className:"rounded-2xl border border-dark-border bg-dark-surface shadow-sm transition-all duration-150 focus-within:border-accent-blue/50 focus-within:ring-4 focus-within:ring-accent-blue/10",children:[s.jsx("textarea",{ref:m,value:c,onChange:S,onKeyDown:D,onPaste:N,onCompositionStart:p,onCompositionEnd:v,placeholder:l(u?"chat.generatingPlaceholder":"chat.inputPlaceholder"),rows:1,disabled:u&&!d,"aria-label":"Message input",className:`w-full bg-transparent px-4 pt-3.5 pb-2 text-sm text-dark-text placeholder-dark-muted/60
15
+ resize-none focus:outline-none min-h-[44px] max-h-[40vh] leading-relaxed
16
+ disabled:opacity-50 disabled:cursor-not-allowed`}),s.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-2.5",children:[s.jsx(Js,{}),s.jsx("span",{className:"text-[11px] text-dark-muted/80 font-mono truncate max-w-[10rem] hidden sm:block",children:b||""}),s.jsx("div",{className:"flex-1"}),k>0&&c.length>0&&s.jsxs("span",{className:`text-[10px] tabular-nums ${C?"text-accent-red font-medium":"text-dark-muted/60"}`,children:["~",k," tokens",C?` · ${l("chat.nearLimit")}`:""]}),u?s.jsxs("div",{className:"flex items-center gap-1.5",children:[d?s.jsx("button",{onClick:i,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-green text-white transition-all hover:opacity-85 active:scale-95",title:l("chat.resumeGen"),"aria-label":l("chat.resumeGen"),children:s.jsx(Pr,{size:14,"aria-hidden":"true"})}):s.jsx("button",{onClick:o,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-yellow text-white transition-all hover:opacity-85 active:scale-95",title:l("chat.pauseGen"),"aria-label":l("chat.pauseGen"),children:s.jsx($r,{size:14,"aria-hidden":"true"})}),s.jsx("button",{onClick:r,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-red text-white transition-all hover:opacity-85 active:scale-95",title:l("chat.stopGen"),"aria-label":l("chat.stopGen"),children:s.jsx(Ur,{size:13,"aria-hidden":"true"})})]}):s.jsx("button",{onClick:I,disabled:!c.trim(),className:`flex h-8 w-8 items-center justify-center rounded-full bg-dark-text text-dark-bg transition-all
17
+ hover:opacity-80 active:scale-95 disabled:opacity-25 disabled:cursor-not-allowed`,title:l("chat.sendBtn"),"aria-label":l("chat.sendBtn"),children:s.jsx(Gr,{size:15,"aria-hidden":"true"})})]})]}),s.jsxs("div",{className:"mt-1.5 hidden sm:flex items-center justify-center gap-3 text-[10px] text-dark-muted/50 select-none",children:[s.jsx("span",{children:l("chat.shiftEnter")}),s.jsx("span",{"aria-hidden":"true",children:"·"}),s.jsx("span",{children:l("chat.escHint")})]})]})}),di=R.memo(function({tabs:t,activeSessionId:n,onSend:r,onStop:o,onPause:i,onResume:l,activeTab:c,setActiveTab:a,createNewSession:u,clearMessages:d,setTheme:m,toggleTerminal:g,setLogs:x,setUnreadLogs:E,showTaskBoard:k=!0,onToggleTaskBoard:b,onRegenerate:f,onDeleteMessage:h}){const S=ye(L=>n?L.messagesBySession[n]||[]:[]),N=ye(L=>n?L.generatingSessions.includes(n):!1),I=ye(L=>n?L.pausedSessions.includes(n):!1),D=Jr(L=>n?L.getTasksForSession(n):[]),p=t.find(L=>L.id===n)||null,v=D.length>0,C=R.useCallback((L,z)=>{n&&r(n,L,z)},[r,n]),w=R.useCallback(L=>{n&&r(n,L)},[r,n]),A=R.useCallback(L=>{n&&f&&f(n,L)},[f,n]),_=R.useCallback(L=>{n&&h&&h(n,L)},[h,n]);return s.jsxs("div",{className:"flex-1 flex min-h-0",children:[s.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:p&&s.jsxs(s.Fragment,{children:[s.jsx(Xs,{messages:S,isGenerating:N,isPaused:I,sessionId:p.id,onSendSuggestion:w,onRegenerate:f?A:void 0,onDeleteMessage:h?_:void 0}),s.jsx(oi,{sessionId:p.id,onSend:C,onStop:()=>o(p.id),onPause:()=>i(p.id),onResume:()=>l(p.id)})]})}),n&&k&&v&&s.jsx("div",{className:"w-80 shrink-0 border-l border-dark-border overflow-hidden flex flex-col min-h-0 max-lg:hidden",children:s.jsx(Qr,{sessionId:n,defaultExpanded:!0,onClose:b})}),n&&!k&&v&&s.jsxs("button",{onClick:b,className:"fixed bottom-6 right-6 z-40 bg-accent-blue text-white rounded-full px-3 py-2 shadow-lg hover:opacity-90 transition-opacity flex items-center gap-1.5 text-xs",children:[s.jsx(Wr,{size:14}),"Task Board"]})]})});export{di as SessionGrid};
@@ -0,0 +1,3 @@
1
+ import{j as e}from"./markdown-BAhUvdx-.js";import{r,m as U,F as ee,l as te,a4 as se,s as ae,p as _,ar as re,as as G,at as ne,au as oe,av as le,ao as ce,aw as ie,ax as de,ay as ue,I as xe}from"./icons-B_rAQLge.js";import{a as y,t as i,e as Y,g as me,c as he,T as ge,D as pe,w as K,n as O}from"./index-BtIzCXfW.js";import"./react-vendor-meeTdQCf.js";import"./state-Cke1lss7.js";const D=r.memo(function({title:d,subtitle:s,enabled:c,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between p-3 bg-dark-bg rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:d}),e.jsx("div",{className:"text-xs text-dark-muted",children:s})]}),e.jsx("button",{onClick:()=>l(!c),className:`relative w-12 h-6 rounded-full transition-colors ${c?"bg-accent-green":"bg-dark-border"}`,children:e.jsx("span",{className:`absolute top-1 w-4 h-4 bg-white rounded-full transition-transform ${c?"left-7":"left-1"}`})})]})});function be(o){return o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`}function fe(o){return new Date(o).toLocaleString()}function ke(){const[o,d]=r.useState([]),[s,c]=r.useState(null),[l,p]=r.useState(""),[b,v]=r.useState(""),[m,n]=r.useState(!1),[g,T]=r.useState(!1),N=r.useCallback(async()=>{n(!0);try{const a=await y.config.files.list();a.success&&Array.isArray(a.data)&&d(a.data)}catch{i.error("Failed to load config files")}finally{n(!1)}},[]),M=r.useCallback(async a=>{try{const S=await y.config.files.read(a);if(S.success&&S.data){const f=S.data;c(f.name),p(f.content),v(f.content)}}catch{i.error(`Failed to read ${a}`)}},[]);r.useEffect(()=>{N()},[N]);const I=r.useCallback(async()=>{if(s){T(!0);try{const a=await y.config.files.write(s,l);a.success?(v(l),i.success(`${s} saved`),N()):i.error(a.error||"Failed to save")}catch{i.error("Failed to save file")}finally{T(!1)}}},[s,l,N]),C=l!==b,L=(s==null?void 0:s.endsWith(".yaml"))||(s==null?void 0:s.endsWith(".yml")),E=s==null?void 0:s.endsWith(".json"),z=a=>L?a.replace(/(#.*)$/,'<span class="text-dark-muted">$1</span>').replace(/^(\s*)([\w-]+)(:)/,'$1<span class="text-accent-blue">$2</span>$3').replace(/:\s+(true|false|null|~)(\s*)$/,': <span class="text-accent-purple">$1</span>$2').replace(/:\s+(\d+\.?\d*)(\s*)$/,': <span class="text-accent-green">$1</span>$2').replace(/:\s+"([^"]*)"(\s*)$/,': <span class="text-accent-yellow">"$1"</span>$2'):E?a.replace(/(\s*"[^"]*")(\s*:)/g,'<span class="text-accent-blue">$1</span>$2').replace(/:\s+(true|false|null)/g,': <span class="text-accent-purple">$1</span>').replace(/:\s+(\d+\.?\d*)/g,': <span class="text-accent-green">$1</span>').replace(/:\s+"([^"]*)"/g,': <span class="text-accent-yellow">"$1"</span>'):a;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-sm font-medium text-dark-text",children:"Config Files"}),e.jsx("button",{onClick:N,disabled:m,className:"p-1.5 rounded hover:bg-dark-hover transition-colors text-dark-muted",title:"Refresh file list",children:e.jsx(U,{size:14,className:m?"animate-spin":""})})]}),o.length===0&&!m&&e.jsx("p",{className:"text-xs text-dark-muted",children:"No config files found in ~/.agent/"}),o.length>0&&e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-48 shrink-0 space-y-0.5 max-h-[300px] overflow-y-auto custom-scrollbar",children:o.map(a=>e.jsxs("button",{onClick:()=>M(a.name),className:`w-full text-left px-2.5 py-1.5 rounded text-xs flex items-center gap-2 transition-colors ${s===a.name?"bg-accent-blue/10 text-accent-blue":"text-dark-text hover:bg-dark-hover"}`,children:[e.jsx(ee,{size:12,className:"shrink-0"}),e.jsx("span",{className:"truncate flex-1",children:a.name}),!a.editable&&e.jsx("span",{className:"text-[10px] text-dark-muted shrink-0",title:"Read-only",children:"read"})]},a.name))}),s?e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted",children:[e.jsx("span",{className:"text-dark-text font-medium",children:s}),o.find(a=>a.name===s)&&e.jsxs("span",{children:[be(o.find(a=>a.name===s).size)," · ",fe(o.find(a=>a.name===s).modified)]}),C&&e.jsxs("span",{className:"text-accent-yellow flex items-center gap-1",children:[e.jsx(te,{size:10}),"unsaved changes"]})]}),e.jsxs("button",{onClick:I,disabled:!C||g,className:`flex items-center gap-1 px-2.5 py-1 rounded text-xs transition-all ${C?"bg-accent-blue text-white hover:opacity-90":"bg-dark-hover text-dark-muted cursor-not-allowed"}`,children:[e.jsx(se,{size:12}),g?"Saving...":"Save"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"w-full h-[260px] p-3 rounded-lg bg-dark-bg border border-dark-border font-mono text-xs leading-relaxed overflow-auto custom-scrollbar pointer-events-none",dangerouslySetInnerHTML:{__html:l.split(`
2
+ `).map(z).join(`
3
+ `)||"&nbsp;"}}),e.jsx("textarea",{value:l,onChange:a=>p(a.target.value),className:"absolute inset-0 w-full h-full p-3 rounded-lg bg-transparent border border-dark-border font-mono text-xs leading-relaxed resize-none overflow-auto custom-scrollbar text-transparent caret-dark-text focus:outline-none focus:border-accent-blue/50",style:{color:"transparent"},spellCheck:!1})]})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-dark-muted",children:"Select a file to edit"})]})]})}const ve=r.memo(function({nameKey:d,descriptionKey:s,colors:c,isSelected:l,onClick:p}){const{t:b}=Y(),v=["bg","surface","border","text","muted","accentBlue","accentGreen","accentRed","accentYellow","accentPurple"];return e.jsxs("button",{onClick:p,className:`relative flex flex-col items-center rounded-xl p-2 transition-all focus:outline-none focus:ring-2 focus:ring-accent-blue/50 ${l?"ring-2 ring-accent-blue/60 bg-dark-bg border border-accent-blue/40 shadow-sm":"border border-dark-border hover:border-accent-blue/30 bg-dark-bg hover:shadow-sm"}`,title:b(s),"aria-pressed":l,"aria-label":b(d),children:[e.jsx("div",{className:"flex gap-[2px] rounded-md overflow-hidden w-full h-8 mb-1.5 border border-dark-border/40",children:v.map(m=>e.jsx("div",{className:"flex-1",style:{backgroundColor:c[m]},title:m},m))}),e.jsx("span",{className:`text-[11px] font-medium truncate w-full text-center ${l?"text-accent-blue":"text-dark-text"}`,children:b(d)}),l&&e.jsx("span",{className:"absolute top-1 right-1 w-4 h-4 bg-accent-blue rounded-full flex items-center justify-center shadow-sm",children:e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:e.jsx("path",{d:"M1.5 4L3.5 6L6.5 2",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}),W=[{key:"bg",labelKey:"settings.colorBg"},{key:"surface",labelKey:"settings.colorSurface"},{key:"border",labelKey:"settings.colorBorder"},{key:"text",labelKey:"settings.colorText"},{key:"muted",labelKey:"settings.colorMuted"},{key:"accentBlue",labelKey:"settings.colorAccentBlue"},{key:"accentGreen",labelKey:"settings.colorAccentGreen"},{key:"accentRed",labelKey:"settings.colorAccentRed"},{key:"accentYellow",labelKey:"settings.colorAccentYellow"},{key:"accentPurple",labelKey:"settings.colorAccentPurple"}],je={language:["language","lang","Chinese","中文","English","en","zh"],theme:["theme","dark","light","color","palette","custom"],advanced:["advanced","yolo","auto","swarm","workspace","guard","bypass"],provider:["provider","model","api","key","openai","anthropic","deepseek"],configFiles:["config","file","yaml","json","editor"],system:["system","server","uptime","restart","reboot"],about:["about","version","info"]},Te=r.memo(function({onNavigate:d}){const{t:s}=Y(),{theme:c,setTheme:l,themePresetId:p,setThemePreset:b,language:v,setLanguage:m,yolo:n,setYoloEnabled:g,autoSwarm:T,setAutoSwarmEnabled:N,workspaceGuardBypass:M,setWorkspaceGuardBypass:I,customTheme:C,customThemeEnabled:L,setCustomTheme:E,setCustomThemeEnabled:z,resetCustomTheme:a}=me(),S=he(t=>t.activeSessionId),[f,H]=r.useState(L),q=r.useMemo(()=>c==="dark"?"dark":c==="light"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",[c]),Q=r.useMemo(()=>Object.values(ge),[]),[P,Z]=r.useState(0),[j,F]=r.useState(!1),[A,R]=r.useState(!1),[$,B]=r.useState(""),k=r.useCallback(t=>{if(!$.trim())return!0;const x=$.toLowerCase().trim();return(je[t]??[]).some(h=>h.toLowerCase().includes(x))},[$]);r.useEffect(()=>{let t=!0;const x=async()=>{try{const h=await y.system.status();t&&h.success&&h.data&&Z(h.data.uptime)}catch{}};x();const u=setInterval(x,j?2e3:1e4);return()=>{t=!1,clearInterval(u)}},[j]);const J=r.useCallback(async()=>{if(window.confirm("Restart the server? All active sessions will be disconnected.")){F(!0);try{const t=await y.system.restart();t.success?i.info("Server restarting..."):(i.error(t.error||"Restart failed"),F(!1))}catch{i.error("Failed to send restart request"),F(!1)}}},[]),V=r.useCallback(async()=>{if(window.confirm("Shut down the server? This will stop the entire backend process.")&&window.confirm("Are you sure? All active sessions and unsaved work will be lost.")){R(!0);try{const t=await y.system.shutdown();t.success?i.info("Server shutting down..."):(i.error(t.error||"Shutdown failed"),R(!1))}catch{i.error("Failed to send shutdown request"),R(!1)}}},[]);r.useEffect(()=>{j&&P<1e4&&(F(!1),i.success("Server restarted"))},[P,j]);const X=t=>{const x=Math.floor(t/1e3),u=Math.floor(x/60),h=Math.floor(u/60);return h>0?`${h}h ${u%60}m`:u>0?`${u}m ${x%60}s`:`${x}s`};return e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar p-4 bg-transparent",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 gap-4 rounded-xl border border-dark-border bg-dark-surface p-3",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2 shrink-0",children:[e.jsx(ae,{size:18,className:"text-accent-blue"}),s("settings.title")]}),e.jsxs("div",{className:"relative flex-1 max-w-xs",children:[e.jsx(_,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-dark-muted pointer-events-none"}),e.jsx("input",{type:"text",value:$,onChange:t=>B(t.target.value),placeholder:"Search settings...",className:"w-full bg-dark-bg border border-dark-border rounded-lg pl-9 pr-3 py-1.5 text-sm text-dark-text placeholder-dark-muted focus:border-accent-blue/60 focus:ring-2 focus:ring-accent-blue/15 outline-none transition-all"}),$&&e.jsx("button",{onClick:()=>B(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dark-muted hover:text-dark-text text-xs p-1 rounded",children:"×"})]})]}),e.jsxs("div",{className:"space-y-5 max-w-3xl",children:[k("language")&&e.jsx(w,{icon:re,iconColor:"text-accent-blue",title:s("settings.language"),children:e.jsx("div",{className:"flex gap-2",children:["zh-CN","en"].map(t=>e.jsx("button",{onClick:()=>m(t),className:`px-4 py-2 rounded-lg transition-all ${v===t?"bg-accent-blue text-white":"bg-dark-hover text-dark-text hover:bg-dark-border"}`,children:s(t==="zh-CN"?"settings.languageZh":"settings.languageEn")},t))})}),k("theme")&&e.jsxs(w,{icon:G,iconColor:"text-accent-purple",title:s("settings.theme"),children:[e.jsx("div",{className:"flex gap-2 mb-4",children:["dark","light","auto"].map(t=>e.jsx("button",{onClick:()=>l(t),className:`px-4 py-2 rounded-lg transition-all ${c===t?"bg-accent-blue text-white":"bg-dark-hover text-dark-text hover:bg-dark-border"}`,children:s(t==="dark"?"settings.themeDark":t==="light"?"settings.themeLight":"settings.themeAuto")},t))}),e.jsxs("div",{className:"mb-4",children:[e.jsx("h4",{className:"text-xs font-semibold text-dark-text mb-2",children:s("settings.themePresets")}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2",children:Q.map(t=>{if(!t)return null;const x=(p||pe)===t.id,u=q==="dark"?t.dark:t.light;return e.jsx(ve,{id:t.id,nameKey:t.nameKey,descriptionKey:t.descriptionKey,colors:u,isSelected:x,onClick:()=>b(t.id)},t.id)})})]}),e.jsxs("div",{className:"pt-4 border-t border-dark-border",children:[e.jsxs("button",{onClick:()=>{const t=!f;H(t),z(t)},className:"flex items-center gap-2 text-sm text-dark-muted hover:text-dark-text transition-colors",children:[e.jsx(G,{size:14}),e.jsx("span",{children:s("settings.customOverrides")}),e.jsx("span",{className:`w-8 h-4 rounded-full transition-colors ${f?"bg-accent-blue":"bg-dark-border"}`,children:e.jsx("span",{className:`block w-3 h-3 rounded-full bg-white transition-transform mt-0.5 ${f?"ml-4":"ml-0.5"}`})})]}),f&&e.jsx("p",{className:"text-[10px] text-dark-muted mt-1 mb-2",children:s("settings.customOverridesHint")}),f&&e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"flex gap-1 mb-3 rounded-lg overflow-hidden h-6",children:W.map(({key:t})=>e.jsx("div",{className:"flex-1",style:{backgroundColor:C[t]},title:t},t))}),e.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:W.map(({key:t,labelKey:x})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"color",value:C[t],onChange:u=>E({[t]:u.target.value}),className:"w-8 h-8 rounded border border-dark-border cursor-pointer bg-transparent p-0.5 shrink-0"}),e.jsx("span",{className:"text-xs text-dark-muted flex-1 truncate",children:s(x)}),e.jsx("input",{type:"text",value:C[t],onChange:u=>{const h=u.target.value;/^#[0-9a-fA-F]{0,6}$/.test(h)&&E({[t]:h})},className:"w-16 bg-dark-bg border border-dark-border rounded px-1 py-0.5 text-xs text-dark-text font-mono text-center",maxLength:7})]},t))}),e.jsx("button",{onClick:a,className:"mt-2 text-xs text-dark-muted hover:text-accent-red transition-colors",children:s("settings.resetColors")})]})]})]}),k("provider")&&e.jsxs(w,{icon:ne,iconColor:"text-accent-yellow",title:"Provider & Models",children:[e.jsx("p",{className:"text-sm text-dark-muted mb-3",children:"Configure AI providers, API keys, and model settings. Add or remove providers like OpenAI, Anthropic, DeepSeek, and more."}),e.jsxs("button",{onClick:()=>d==null?void 0:d("models"),className:"flex items-center gap-2 px-4 py-2 bg-accent-blue text-white rounded-lg hover:opacity-90 transition-opacity text-sm w-fit",children:[e.jsx(oe,{size:14}),"Manage Providers & Models"]})]}),k("context")&&e.jsx(w,{icon:le,iconColor:"text-accent-blue",title:"Max Context",children:e.jsx(we,{})}),k("advanced")&&e.jsx(w,{icon:ce,iconColor:"text-accent-yellow",title:s("settings.advancedFeatures"),children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(D,{title:s("settings.yoloMode"),subtitle:s("settings.yoloDesc"),enabled:n.enabled,onChange:t=>{g(t),K.send({type:"toggle_yolo",sessionId:S||"",data:t?"true":"false"})}}),e.jsx(D,{title:s("settings.autoSwarm"),subtitle:s("settings.autoSwarmDesc"),enabled:T.enabled,onChange:t=>{N(t),K.send({type:"toggle_auto_swarm",sessionId:S||"",data:t?"true":"false"})}}),e.jsx(D,{title:s("settings.workspaceGuard"),subtitle:s("settings.workspaceGuardDesc"),enabled:M,onChange:t=>{I(t),K.send({type:"toggle_workspace_guard",sessionId:S||"",data:t?"true":"false"})}})]})}),k("configFiles")&&e.jsx(w,{icon:ie,iconColor:"text-accent-green",title:"Config Files (~/.agent/)",children:e.jsx(ke,{})}),k("system")&&e.jsx(w,{icon:de,iconColor:"text-dark-muted",title:"System",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-dark-muted",children:"Server Uptime"}),e.jsx("span",{className:"text-dark-text font-mono",children:X(P)})]}),e.jsxs("button",{onClick:J,disabled:j,className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm transition-all ${j?"bg-dark-hover text-dark-muted cursor-wait":"bg-accent-red/10 text-accent-red hover:bg-accent-red/20 border border-accent-red/30"}`,children:[e.jsx(U,{size:14,className:j?"animate-spin":""}),j?"Restarting...":"Restart Server"]}),e.jsxs("button",{onClick:V,disabled:A,className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm transition-all ${A?"bg-dark-hover text-dark-muted cursor-wait":"bg-accent-red/10 text-accent-red hover:bg-accent-red/20 border border-accent-red/30"}`,children:[e.jsx(ue,{size:14,className:A?"animate-pulse":""}),A?"Shutting Down...":"Shutdown Server"]})]})}),k("about")&&e.jsx(w,{icon:xe,iconColor:"text-accent-blue",title:s("settings.about"),children:e.jsxs("div",{className:"text-sm text-dark-muted space-y-2",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-dark-text",children:"DeepSeekCode Web"})," v1.0.0"]}),e.jsx("p",{children:s("settings.aboutDesc")}),e.jsx("p",{className:"text-xs",children:"Powered by React + TypeScript + TailwindCSS"})]})}),$.trim()&&!["language","theme","provider","advanced","configFiles","system","about"].some(k)&&e.jsxs("div",{className:"text-center py-12 text-dark-muted",children:[e.jsx(_,{size:32,className:"mx-auto mb-2 opacity-40"}),e.jsxs("p",{className:"text-sm",children:["No settings match “",$,"”"]})]})]})]})});function we(){const o=O(n=>n.maxContextTokens),d=O(n=>n.setMaxContextTokens),[s,c]=r.useState(String(o)),[l,p]=r.useState(!1),b=[32e3,64e3,128e3,256e3,512e3,1e6,2e6],v=async()=>{const n=parseInt(s,10);if(!(isNaN(n)||n<1e3)){p(!0),d(n);try{await y.config.provider.save({contextWindow:n}),i.success("Context window saved")}catch(g){i.error("Failed to save context window: "+(g instanceof Error?g.message:"Unknown error"))}p(!1)}},m=n=>n>=1e6?(n/1e6).toFixed(0)+"M":(n/1e3).toFixed(0)+"K";return e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-dark-muted mb-3",children:"Set the maximum context window (in tokens) for your AI model. This controls how the progress bar and usage percentage are calculated."}),e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("input",{type:"number",value:s,onChange:n=>c(n.target.value),min:1e3,max:1e7,step:1e3,className:"w-32 bg-dark-bg border border-dark-border rounded-lg px-3 py-1.5 text-sm text-dark-text font-mono focus:border-accent-blue/60 focus:ring-2 focus:ring-accent-blue/15 outline-none transition-all"}),e.jsx("span",{className:"text-sm text-dark-muted",children:"tokens"}),e.jsx("button",{onClick:v,disabled:l,className:"px-3 py-1.5 rounded-lg text-sm bg-accent-blue text-white hover:opacity-90 transition-opacity disabled:opacity-50",children:l?"Saving...":"Apply"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:b.map(n=>e.jsx("button",{onClick:async()=>{c(String(n)),d(n);try{await y.config.provider.save({contextWindow:n}),i.success("Context window saved")}catch(g){i.error("Failed to save context window: "+(g instanceof Error?g.message:"Unknown error"))}},className:"px-3 py-1 rounded-lg text-xs transition-all",children:m(n)},n))}),e.jsxs("p",{className:"text-xs text-dark-muted mt-2",children:["Current: ",e.jsx("span",{className:"font-mono text-dark-text",children:parseInt(s,10).toLocaleString()})," tokens"]})]})}function w({icon:o,iconColor:d,title:s,children:c}){return e.jsxs("div",{className:"rounded-xl border border-dark-border bg-dark-surface p-4",children:[e.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[e.jsx(o,{size:16,className:d}),s]}),c]})}export{Te as SettingsPanel};
@@ -0,0 +1 @@
1
+ import{j as e}from"./markdown-BAhUvdx-.js";import{r as l,m as A,l as X,a2 as Z,P as ee,a3 as se,_ as $,$ as O,a4 as _,a5 as te}from"./icons-B_rAQLge.js";import"./Toast-DowV4l0w.js";import{e as re,M as U,a as p}from"./index-BtIzCXfW.js";import"./react-vendor-meeTdQCf.js";import"./state-Cke1lss7.js";const T={id:"",name:"",description:"",category:"",trigger:"",systemPrompt:"",injection:"lazy",tags:"",requiredTools:""};function oe(){const{t}=re(),[d,b]=l.useState([]),[f,E]=l.useState(!0),[P,j]=l.useState(null),[k,D]=l.useState(""),[v,N]=l.useState(null),[H,x]=l.useState(!1),[y,w]=l.useState(null),[I,q]=l.useState(!1),[F,u]=l.useState(null),[a,c]=l.useState(T),[Q,C]=l.useState(!1),[V,L]=l.useState(!1),[M,S]=l.useState(null),h=l.useRef(null),g=async()=>{E(!0),j(null);const s=await p.skills.list();if(s.success){const r=Array.isArray(s.data)?s.data:[];b(r),N(n=>{var o;return n&&r.some(W=>W.id===n)?n:((o=r[0])==null?void 0:o.id)||null}),s.data!==null&&s.data!==void 0&&!Array.isArray(s.data)&&j("服务端返回的技能数据格式异常")}else j(s.error||t("skills.loadFailedFallback"));E(!1)};l.useEffect(()=>{g()},[]);const i=l.useMemo(()=>d.find(s=>s.id===v)||d[0]||null,[d,v]),z=l.useMemo(()=>{const s=k.trim().toLowerCase();return s?d.filter(r=>[r.id,r.name,r.description,r.category,...r.tags||[]].join(" ").toLowerCase().includes(s)):d},[d,k]),Y=()=>{w(null),c(T),u(null),x(!0)},G=s=>{w(s.id),c({id:s.id,name:s.name,description:s.description,category:s.category,trigger:s.trigger||"",systemPrompt:s.systemPrompt||"",injection:s.injection||"lazy",tags:(s.tags||[]).join(", "),requiredTools:(s.requiredTools||[]).join(", ")}),u(null),x(!0)},J=async()=>{const s=a.id.trim();if(!s){u(t("skills.fieldId")+" is required");return}q(!0),u(null);const r={id:s,name:a.name.trim(),description:a.description.trim(),category:a.category.trim(),trigger:a.trigger.trim(),systemPrompt:a.systemPrompt,injection:a.injection.trim(),tags:B(a.tags),requiredTools:B(a.requiredTools)},n=y?await p.skills.update(y,r):await p.skills.create(r);n.success?(x(!1),w(null),c(T),await g(),N(s)):u(n.error||t("skills.save")),q(!1)},R=async s=>{(await p.skills.toggle(s.id,!s.enabled)).success&&b(n=>n.map(o=>o.id===s.id?{...o,enabled:!o.enabled}:o))},K=async s=>{L(!0),S(null);try{const r=await s.text(),n=await p.skills.import({fileName:s.name,content:r});n.success?(C(!1),await g()):S(n.error||t("skills.import"))}catch(r){S(r instanceof Error?r.message:t("skills.import"))}finally{L(!1),h.current&&(h.current.value="")}};return f?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(A,{size:32,className:"animate-spin mx-auto mb-2 text-accent-blue"}),e.jsx("p",{className:"text-dark-muted",children:"Loading..."})]})}):P?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(X,{size:32,className:"mx-auto mb-2 text-accent-red"}),e.jsx("p",{className:"text-accent-red mb-4",children:P}),e.jsx("button",{onClick:g,className:"px-4 py-2 bg-accent-blue text-white rounded-lg",children:t("skills.retry")})]})}):e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-4 gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(Z,{size:20}),t("skills.title"),e.jsxs("span",{className:"text-sm font-normal text-dark-muted",children:["(",d.length,")"]})]}),e.jsx("input",{value:k,onChange:s=>D(s.target.value),placeholder:"Search skills",className:"w-56 px-3 py-2 bg-dark-surface border border-dark-border rounded-lg text-sm outline-none focus:border-accent-blue"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:Y,className:"flex items-center gap-2 px-3 py-2 bg-accent-blue text-white rounded-lg",children:[e.jsx(ee,{size:14}),t("skills.new")]}),e.jsxs("button",{onClick:()=>C(!0),className:"flex items-center gap-2 px-3 py-2 bg-dark-surface border border-dark-border rounded-lg",children:[e.jsx(se,{size:14}),t("skills.import")]}),e.jsxs("button",{onClick:g,className:"flex items-center gap-2 px-3 py-2 bg-dark-surface border border-dark-border rounded-lg",children:[e.jsx(A,{size:14}),t("skills.refresh")]})]})]}),e.jsxs("div",{className:"grid grid-cols-[320px_minmax(0,1fr)] gap-4 flex-1 min-h-0",children:[e.jsxs("div",{className:"border border-dark-border rounded-lg overflow-hidden bg-dark-surface flex flex-col min-h-0",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-dark-border text-sm text-dark-muted flex items-center justify-between",children:[e.jsx("span",{children:t("skills.list")}),e.jsx("span",{children:z.length})]}),e.jsxs("div",{className:"overflow-y-auto custom-scrollbar",children:[z.map(s=>e.jsx("button",{onClick:()=>N(s.id),className:`w-full text-left px-3 py-3 border-b border-dark-border/60 hover:bg-dark-hover ${v===s.id?"bg-dark-hover":""}`,children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("div",{className:"min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:s.icon||"⭐"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium truncate",children:s.name}),e.jsx("div",{className:"text-xs text-dark-muted truncate",children:s.id})]})]})}),e.jsxs("button",{onClick:r=>{r.stopPropagation(),R(s)},className:`flex items-center gap-1 px-2 py-1 rounded text-xs font-medium transition-colors ${s.enabled?"bg-accent-green/20 text-accent-green hover:bg-accent-green/30":"bg-accent-red/20 text-accent-red hover:bg-accent-red/30"}`,title:s.enabled?t("skills.disable"):t("skills.enable"),children:[s.enabled?e.jsx($,{size:16}):e.jsx(O,{size:16}),s.enabled?t("skills.enabled"):t("skills.disabled")]})]})},s.id)),z.length===0&&e.jsx("div",{className:"p-4 text-sm text-dark-muted",children:t("skills.noSkills")})]})]}),e.jsx("div",{className:"border border-dark-border rounded-lg bg-dark-surface min-h-0 overflow-hidden flex flex-col",children:i?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-4 py-3 border-b border-dark-border flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:i.icon||"⭐"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-semibold truncate",children:i.name}),e.jsxs("div",{className:"text-xs text-dark-muted",children:[i.id," · ",i.category]})]})]}),e.jsx("p",{className:"mt-2 text-sm text-dark-muted whitespace-pre-wrap",children:i.description})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>R(i),className:`flex items-center gap-1 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${i.enabled?"bg-accent-green/20 text-accent-green hover:bg-accent-green/30":"bg-accent-red/20 text-accent-red hover:bg-accent-red/30"}`,children:[i.enabled?e.jsx($,{size:14}):e.jsx(O,{size:14}),i.enabled?t("skills.enabled"):t("skills.disabled")]}),e.jsxs("button",{onClick:()=>G(i),className:"px-3 py-2 bg-accent-blue text-white rounded-lg text-sm flex items-center gap-2",children:[e.jsx(_,{size:14}),t("skills.edit")]})]})]}),e.jsxs("div",{className:"p-4 overflow-y-auto custom-scrollbar text-sm space-y-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-dark-muted mb-1",children:t("skills.tags")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:(i.tags||[]).length>0?i.tags.map(s=>e.jsx("span",{className:"px-2 py-1 rounded bg-dark-bg border border-dark-border",children:s},s)):e.jsx("span",{className:"text-dark-muted",children:t("skills.none")})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-dark-muted mb-1",children:t("skills.source")}),e.jsx("div",{className:"break-all",children:i.source||t("skills.localSkill")})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-dark-muted mb-1",children:t("skills.systemPrompt")}),e.jsx("pre",{className:"whitespace-pre-wrap text-xs p-3 rounded border border-dark-border bg-dark-bg overflow-auto custom-scrollbar",children:i.systemPrompt||t("skills.none")})]})]})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-dark-muted",children:t("skills.selectSkill")})})]}),e.jsx(U,{isOpen:H,onClose:()=>x(!1),title:t(y?"skills.edit":"skills.new"),size:"xl",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(m,{label:t("skills.fieldId"),value:a.id,onChange:s=>c(r=>({...r,id:s}))}),e.jsx(m,{label:t("skills.fieldName"),value:a.name,onChange:s=>c(r=>({...r,name:s}))}),e.jsx(m,{label:t("skills.fieldCategory"),value:a.category,onChange:s=>c(r=>({...r,category:s}))}),e.jsx(m,{label:t("skills.fieldTrigger"),value:a.trigger,onChange:s=>c(r=>({...r,trigger:s}))}),e.jsx(m,{label:t("skills.tags"),value:a.tags,onChange:s=>c(r=>({...r,tags:s}))}),e.jsx(m,{label:t("skills.fieldTools"),value:a.requiredTools,onChange:s=>c(r=>({...r,requiredTools:s}))}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"block text-sm mb-1 text-dark-muted",children:t("skills.description")}),e.jsx("textarea",{value:a.description,onChange:s=>c(r=>({...r,description:s.target.value})),className:"w-full h-20 px-3 py-2 rounded-lg bg-dark-bg border border-dark-border outline-none resize-none"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"block text-sm mb-1 text-dark-muted",children:t("skills.systemPrompt")}),e.jsx("textarea",{value:a.systemPrompt,onChange:s=>c(r=>({...r,systemPrompt:s.target.value})),className:"w-full h-40 px-3 py-2 rounded-lg bg-dark-bg border border-dark-border outline-none resize-none font-mono text-sm"})]}),F&&e.jsx("div",{className:"col-span-2 text-sm text-accent-red",children:F}),e.jsxs("div",{className:"col-span-2 flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>x(!1),className:"px-4 py-2 border border-dark-border rounded-lg",children:t("skills.cancel")}),e.jsxs("button",{disabled:I,onClick:J,className:"px-4 py-2 bg-accent-blue text-white rounded-lg flex items-center gap-2",children:[e.jsx(_,{size:14}),t(I?"skills.saving":"skills.save")]})]})]})}),e.jsx(U,{isOpen:Q,onClose:()=>C(!1),title:t("skills.importTitle"),size:"md",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("input",{ref:h,type:"file",accept:".md,.skill.md,.txt",className:"hidden",onChange:s=>{var n;const r=(n=s.target.files)==null?void 0:n[0];r&&K(r)}}),e.jsxs("button",{onClick:()=>{var s;return(s=h.current)==null?void 0:s.click()},disabled:V,className:"w-full py-6 border border-dashed border-dark-border rounded-lg flex items-center justify-center gap-2",children:[e.jsx(te,{size:16}),t("skills.chooseFile")]}),M&&e.jsx("div",{className:"text-sm text-accent-red",children:M}),e.jsx("div",{className:"text-xs text-dark-muted",children:t("skills.importHint")})]})})]})}function B(t){return t.split(",").map(d=>d.trim()).filter(Boolean)}function m({label:t,value:d,onChange:b}){return e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm mb-1 text-dark-muted",children:t}),e.jsx("input",{value:d,onChange:f=>b(f.target.value),className:"w-full px-3 py-2 rounded-lg bg-dark-bg border border-dark-border outline-none focus:border-accent-blue"})]})}export{oe as SkillsView};
@@ -0,0 +1,3 @@
1
+ import{j as r}from"./markdown-BAhUvdx-.js";import{r as s,af as U,ag as K,m as V,ah as _,D as q,K as Q,ai as X,aj as Z}from"./icons-B_rAQLge.js";import{x as ee,a as te}from"./terminal-Ck_l6svU.js";import{f as $,g as re,h as j,t as se}from"./index-BtIzCXfW.js";import"./react-vendor-meeTdQCf.js";import"./state-Cke1lss7.js";const ne={background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",cursorAccent:"#1e1e1e",black:"#1e1e1e",red:"#f44747",green:"#608b4e",yellow:"#dcdcaa",blue:"#569cd6",magenta:"#c586c0",cyan:"#4ec9b0",white:"#d4d4d4",brightBlack:"#808080",brightRed:"#f44747",brightGreen:"#608b4e",brightYellow:"#dcdcaa",brightBlue:"#569cd6",brightMagenta:"#c586c0",brightCyan:"#4ec9b0",brightWhite:"#ffffff"};function de(){const f=s.useRef(null),a=s.useRef(null),g=s.useRef(null),o=s.useRef(null),[C,M]=s.useState(!1),[w,v]=s.useState(null),[B,R]=s.useState(!0),d=s.useRef(!1),S=s.useRef({isAtBottom:!0}),I=s.useCallback(t=>{const e=a.current;if(!e)return;const n=e.buffer.active;S.current.isAtBottom=n.baseY+e.rows>=n.length,e.write(t,()=>{S.current.isAtBottom&&!d.current&&e.scrollToBottom();const l=e.buffer.active;l.baseY+e.rows>=l.length&&(d.current=!1)})},[]),[k,y]=s.useState(""),p=s.useCallback(()=>{const t=a.current,e=o.current;!t||!e||e.readyState!==WebSocket.OPEN||e.send(JSON.stringify({type:"resize",cols:t.cols,rows:t.rows}))},[]),{status:T,errorMessage:N,port:z}=$(),{setStarting:E,setRunning:A,setStopping:D,setIdle:L,setError:m}=$(),{workspaceDir:x}=re(),b=s.useCallback(()=>{o.current&&(o.current.onclose=null,o.current.onmessage=null,o.current.onerror=null,o.current.onopen=null,o.current.close(),o.current=null)},[]),h=s.useCallback(async t=>{E(),t.writeln("\x1B[90mStarting local terminal...\x1B[0m");try{const e=await j.post("/api/terminal/start",{workspaceDir:x});if(!e.success||!e.data){const c=e.error||"Failed to start terminal";m(c),t.writeln(`\x1B[31m${c}\x1B[0m`);return}const n=e.data.port??e.data.ttydPort,l=e.data.wsUrl;if(!n||!l){const c="Invalid terminal start response";m(c),t.writeln(`\x1B[31m${c}\x1B[0m`);return}A(n,l),y(e.data.workspaceDir||x);const u=new WebSocket(l);o.current=u,u.onopen=()=>{t.clear(),t.focus(),t.writeln("\x1B[32mConnected to local shell\x1B[0m"),setTimeout(()=>{var c,i;(c=g.current)==null||c.fit(),p(),d.current||(i=a.current)==null||i.scrollToBottom()},50)},u.onmessage=c=>{typeof c.data=="string"&&I(c.data)},u.onerror=()=>{m("Terminal connection error")},u.onclose=()=>{o.current===u&&(o.current=null,m("Terminal disconnected"),t.writeln("\x1B[33mTerminal disconnected\x1B[0m"))}}catch(e){const n=e instanceof Error?e.message:"Unknown error";m(n),t.writeln(`\x1B[31m${n}\x1B[0m`)}},[x,E,A,m,p]),F=s.useCallback(async()=>{b(),D();try{await j.post("/api/terminal/stop")}catch{}L()},[b,D,L]);s.useEffect(()=>{f.current&&j.get("/api/terminal/status").then(t=>{const e=t.success&&t.data?t.data:null;v((e==null?void 0:e.terminalAvailable)!==!1),e!=null&&e.workspaceDir&&y(e.workspaceDir)}).catch(()=>v(!1))},[]),s.useEffect(()=>{if(w!==!0||!f.current)return;const t=new ee.Terminal({theme:ne,fontFamily:'"Cascadia Code", "Fira Code", Consolas, "Courier New", monospace',fontSize:14,lineHeight:1.2,cursorBlink:!0,cursorStyle:"block",scrollback:1e4,convertEol:!0}),e=new te.FitAddon;t.loadAddon(e),t.open(f.current),t.focus(),e.fit(),a.current=t,g.current=e,t.writeln("\x1B[36mDeepSeekCode Local Terminal\x1B[0m"),t.writeln("\x1B[90mRun commands directly on this machine.\x1B[0m");const n=t.onData(i=>{var W;((W=o.current)==null?void 0:W.readyState)===WebSocket.OPEN&&o.current.send(i)}),l=t.onScroll(()=>{const i=t.buffer.active;i.baseY+t.rows<i.length&&(d.current=!0,R(!1))}),u=()=>{var i;(i=g.current)==null||i.fit(),p(),d.current||t.scrollToBottom()};window.addEventListener("resize",u);const c=window.setTimeout(()=>h(t),50);return()=>{clearTimeout(c),window.removeEventListener("resize",u),n.dispose(),l.dispose(),F(),t.dispose(),a.current=null}},[w,h,F,p]);const O=s.useCallback(()=>{var e;const t=(e=a.current)==null?void 0:e.getSelection();t&&(navigator.clipboard.writeText(t),se.success("Copied selection"))},[]),P=s.useCallback(()=>{var t,e;(t=a.current)==null||t.clear(),d.current||(e=a.current)==null||e.scrollToBottom()},[]),Y=s.useCallback(()=>{b(),a.current&&(a.current.clear(),h(a.current))},[b,h]),H=s.useCallback(()=>{R(t=>{var n;const e=!t;return d.current=!e,e&&((n=a.current)==null||n.scrollToBottom()),e})},[]),G=s.useCallback(()=>{const t=`Workspace: ${k||x}
2
+ Terminal session: ${z??""}
3
+ `,e=new Blob([t],{type:"text/plain"}),n=URL.createObjectURL(e),l=document.createElement("a");l.href=n,l.download=`terminal-${Date.now()}.log`,l.click(),URL.revokeObjectURL(n)},[x,k,z]),J=s.useMemo(()=>({idle:"Idle",starting:"Connecting",running:"Connected",stopping:"Stopping",error:"Error"})[T],[T]);return w===!1?r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-[#1e1e1e] gap-3 p-8",children:[r.jsx(U,{size:44,className:"text-dark-muted opacity-40"}),r.jsx("div",{className:"text-sm text-dark-muted",children:"Local terminal unavailable"})]}):r.jsxs("div",{className:`flex flex-col bg-[#1e1e1e] border-t border-dark-border ${C?"fixed inset-0 z-50":"flex-1 min-h-0"}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2 bg-[#252526] border-b border-[#3c3c3c]",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(U,{size:14,className:"text-dark-muted shrink-0"}),r.jsx("span",{className:"text-xs text-dark-muted shrink-0",children:"Terminal"}),r.jsx("span",{className:"text-xs text-dark-muted truncate",children:k||x}),r.jsxs("span",{className:"text-xs text-dark-muted",children:["[",J,"]"]}),N&&r.jsx("span",{className:"text-xs text-accent-red truncate max-w-[240px]",children:N})]}),r.jsxs("div",{className:"flex items-center gap-1 flex-wrap justify-end",children:[r.jsx("button",{onClick:H,className:`p-1 rounded hover:bg-[#3c3c3c] ${B?"text-accent-blue":"text-dark-muted"} hover:text-dark-text`,title:B?"璺熼殢杈撳嚭锛氬紑":"璺熼殢杈撳嚭锛氬叧",children:r.jsx(K,{size:12})}),r.jsx("button",{onClick:Y,className:"p-1 rounded hover:bg-[#3c3c3c] text-dark-muted hover:text-dark-text",title:"Restart",children:r.jsx(V,{size:12})}),r.jsx("button",{onClick:O,className:"p-1 rounded hover:bg-[#3c3c3c] text-dark-muted hover:text-dark-text",title:"Copy",children:r.jsx(_,{size:12})}),r.jsx("button",{onClick:G,className:"p-1 rounded hover:bg-[#3c3c3c] text-dark-muted hover:text-dark-text",title:"Download log",children:r.jsx(q,{size:12})}),r.jsx("button",{onClick:P,className:"p-1 rounded hover:bg-[#3c3c3c] text-dark-muted hover:text-dark-text",title:"Clear",children:r.jsx(Q,{size:12})}),r.jsx("button",{onClick:()=>M(t=>!t),className:"p-1 rounded hover:bg-[#3c3c3c] text-dark-muted hover:text-dark-text",title:"Fullscreen",children:C?r.jsx(X,{size:12}):r.jsx(Z,{size:12})})]})]}),r.jsx("div",{ref:f,className:"flex-1 overflow-hidden"})]})}export{de as TerminalView,de as default};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) 2014 The xterm.js authors. All rights reserved.
3
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
4
+ * https://github.com/chjj/term.js
5
+ * @license MIT
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ * Originally forked from (with the author's permission):
26
+ * Fabrice Bellard's javascript vt100 for jslinux:
27
+ * http://bellard.org/jslinux/
28
+ * Copyright (c) 2011 Fabrice Bellard
29
+ * The original design remains. The terminal itself
30
+ * has been extended to include xterm CSI codes, among
31
+ * other features.
32
+ */.xterm{cursor:text;position:relative;-moz-user-select:none;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility,.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:double underline;text-decoration:double underline}.xterm-underline-3{-webkit-text-decoration:wavy underline;text-decoration:wavy underline}.xterm-underline-4{-webkit-text-decoration:dotted underline;text-decoration:dotted underline}.xterm-underline-5{-webkit-text-decoration:dashed underline;text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm{height:100%;padding:8px}.xterm-viewport{overflow-y:auto}.xterm-screen{height:100%}.xterm-viewport::-webkit-scrollbar{width:10px;height:10px}.xterm-viewport::-webkit-scrollbar-track{background:transparent}.xterm-viewport::-webkit-scrollbar-thumb{background:#ffffff2e;border-radius:5px;border:2px solid transparent;background-clip:content-box}.xterm-viewport::-webkit-scrollbar-thumb:hover{background:#ffffff52;background-clip:content-box}.xterm-viewport{scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.18) transparent}
@@ -0,0 +1 @@
1
+ import"./markdown-BAhUvdx-.js";import{r}from"./icons-B_rAQLge.js";r.createContext(null);
@@ -0,0 +1 @@
1
+ import{j as s}from"./markdown-BAhUvdx-.js";import{r as a,m as y,l as $,v as k,p as A,a as R,i as F,Z as v,_ as M,$ as D}from"./icons-B_rAQLge.js";import{u as O,a as w,b as P}from"./index-BtIzCXfW.js";import"./react-vendor-meeTdQCf.js";import"./state-Cke1lss7.js";function _(){const m=O(e=>e.mode),u=m==="normal"?"act":P(m),[l,p]=a.useState([]),[d,b]=a.useState([]),[C,g]=a.useState(!0),[h,i]=a.useState(null),[r,z]=a.useState(""),[c,f]=a.useState(null),[n,j]=a.useState(null),o=async()=>{g(!0),i(null);const e=await w.tools.list();e.success&&Array.isArray(e.data)?(p(e.data),b(e.data)):e.success&&e.data&&!Array.isArray(e.data)?i("服务端返回的工具数据格式异常"):i(e.error||"加载工具失败"),g(!1)};a.useEffect(()=>{o()},[]),a.useEffect(()=>{let e=l;r&&(e=e.filter(t=>t.name.toLowerCase().includes(r.toLowerCase())||t.description.toLowerCase().includes(r.toLowerCase()))),c&&(e=e.filter(t=>t.category===c)),b(e)},[r,c,l]);const S=async(e,t)=>{(await w.tools.toggle(e,!t)).success&&p(L=>L.map(x=>x.id===e?{...x,enabled:!t}:x))},T=[...new Set(l.map(e=>e.category))],E=e=>({file:"bg-accent-blue/20 text-accent-blue",search:"bg-accent-green/20 text-accent-green",git:"bg-accent-yellow/20 text-accent-yellow",web:"bg-accent-purple/20 text-accent-purple",system:"bg-accent-red/20 text-accent-red"})[e]||"bg-dark-hover text-dark-muted";return C?s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx(y,{size:32,className:"animate-spin mx-auto mb-2 text-accent-blue"}),s.jsx("p",{className:"text-dark-muted",children:"加载中..."})]})}):h?s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx($,{size:32,className:"mx-auto mb-2 text-accent-red"}),s.jsx("p",{className:"text-accent-red mb-4",children:h}),s.jsx("button",{onClick:o,className:"px-4 py-2 bg-accent-blue text-white rounded-lg",children:"重试"})]})}):s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[s.jsx(k,{size:20}),"工具列表",s.jsxs("span",{className:"text-sm font-normal text-dark-muted",children:["(",d.length,")"]})]}),s.jsxs("button",{onClick:o,className:"flex items-center gap-2 px-3 py-1.5 bg-dark-surface border border-dark-border rounded hover:bg-dark-hover transition-colors",children:[s.jsx(y,{size:14}),"刷新"]})]}),s.jsxs("div",{className:"flex gap-3 mb-4",children:[s.jsxs("div",{className:"flex-1 relative",children:[s.jsx(A,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-dark-muted"}),s.jsx("input",{type:"text",value:r,onChange:e=>z(e.target.value),placeholder:"搜索工具...",className:"w-full pl-10 pr-4 py-2 bg-dark-surface border border-dark-border rounded-lg text-dark-text placeholder-dark-muted focus:border-accent-blue focus:outline-none"})]}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx("button",{onClick:()=>f(null),className:`px-3 py-2 rounded-lg text-sm transition-colors ${c?"bg-dark-surface border border-dark-border hover:bg-dark-hover":"bg-accent-blue text-white"}`,children:"全部"}),T.slice(0,4).map(e=>s.jsx("button",{onClick:()=>f(e),className:`px-3 py-2 rounded-lg text-sm transition-colors ${c===e?"bg-accent-blue text-white":"bg-dark-surface border border-dark-border hover:bg-dark-hover"}`,children:e},e))]})]}),s.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar",children:s.jsxs("div",{className:"space-y-2",children:[d.map(e=>s.jsxs("div",{className:`bg-dark-surface border rounded-lg transition-colors ${e.enabled?"border-dark-border":"border-dark-border opacity-60"}`,children:[s.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>j(n===e.id?null:e.id),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[s.jsx("button",{onClick:t=>{t.stopPropagation(),j(n===e.id?null:e.id)},className:"text-dark-muted",children:n===e.id?s.jsx(R,{size:16}):s.jsx(F,{size:16})}),s.jsx("span",{className:`px-2 py-0.5 rounded text-xs ${E(e.category)}`,children:e.category}),s.jsx("span",{className:"font-medium",children:e.name}),u==="plan"&&(e.category==="File Operation"||e.category==="Execution")&&s.jsx(v,{size:14,className:"text-accent-red ml-1.5"}),u==="plan"&&(e.category==="File Operation"||e.category==="Execution")&&s.jsx(v,{size:14,className:"text-accent-red ml-1.5"})]}),s.jsx("div",{className:"flex items-center gap-3",children:s.jsx("button",{onClick:t=>{t.stopPropagation(),S(e.id,e.enabled)},className:`p-1.5 rounded transition-colors ${e.enabled?"text-accent-green hover:bg-accent-green/10":"text-dark-muted hover:bg-dark-hover"}`,title:e.enabled?"禁用":"启用",children:e.enabled?s.jsx(M,{size:24}):s.jsx(D,{size:24})})})]}),n===e.id&&s.jsxs("div",{className:"px-4 pb-4 border-t border-dark-border",children:[s.jsx("p",{className:"text-sm text-dark-muted mt-3 mb-3",children:e.description}),e.params&&e.params.length>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-xs text-dark-muted mb-2",children:"参数"}),s.jsx("div",{className:"space-y-1",children:e.params.map((t,N)=>s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsxs("code",{className:"px-1.5 py-0.5 bg-dark-bg rounded text-accent-blue",children:[t.name,t.required&&s.jsx("span",{className:"text-accent-red",children:"*"})]}),s.jsxs("span",{className:"text-dark-muted text-xs",children:["(",t.type,")"]}),s.jsx("span",{className:"text-dark-muted text-xs",children:t.description})]},N))})]})]})]},e.id)),d.length===0&&s.jsxs("div",{className:"text-center text-dark-muted py-8",children:[s.jsx(k,{size:48,className:"mx-auto mb-2 opacity-50"}),s.jsx("p",{children:"暂无工具"})]})]})})]})}export{_ as ToolsView,_ as default};
@@ -0,0 +1 @@
1
+ import{q as t,r as s}from"./index-BtIzCXfW.js";function o(e,r){switch(t(e,r)){case"critical":return{level:"CRITICAL",reasonKey:"risk_critical"};case"high":return{level:"HIGH",reasonKey:/rm\s+-rf|sudo|chmod\s+777|curl.*\|\s*(ba)?sh|wget.*-O|>\/dev\/|mkfs/i.test(r)?"risk_critical_cmd":/write|edit|save|upload|deploy|publish/i.test(e)?"risk_high_file":/install|uninstall|npm|pip|cargo|gem|apt|brew|choco|yum|dnf/i.test(e)?"risk_high_pkg":"risk_high_shell"};case"low":return{level:"LOW",reasonKey:"risk_low"};default:return{level:"MEDIUM",reasonKey:/git|commit|push|merge|rebase/i.test(e)?"risk_git":"risk_network"}}}const b={CRITICAL:{bg:"bg-red-900/20",border:"border-red-500/40",text:"text-red-400",badge:"bg-red-500/20 text-red-400 border-red-500/30",icon:"🚨"},HIGH:{bg:"bg-orange-900/15",border:"border-orange-500/30",text:"text-orange-400",badge:"bg-orange-500/20 text-orange-400 border-orange-500/30",icon:"⚠️"},MEDIUM:{bg:"bg-yellow-900/10",border:"border-yellow-500/25",text:"text-yellow-400",badge:"bg-yellow-500/15 text-yellow-400 border-yellow-500/25",icon:"📋"},LOW:{bg:"bg-blue-900/10",border:"border-blue-500/25",text:"text-blue-400",badge:"bg-blue-500/15 text-blue-400 border-blue-500/25",icon:"✅"}};function a(e,r){return s(e,r)}export{b as R,o as c,a as e};